Welcome Guest, Not a member yet? Register   Sign In
upload images prob
#1

[eluser]RaZoR LeGaCy[/eluser]
I am able to create the dynamic directories on the server but the images do not upload.

Unsure of what is wrong.

I would also like to be able to transfer the name of each input and then add it to each upload as the specific filename. Can it be done?

I read the user manual already and I still can't make heads or tails for some reason.

View File
Code:
<?=form_open_multipart('cp/listing/add', array('id' => 'login_form'))?>
<table>
<tr>
    <td align="right" valign="top">Image #1:</td>
    <td colspan="2">&lt;input type="file" name="1" size="20" id="1" /&gt;</td>
    <td width="100" align="right">Image #2:</td>
    <td>&lt;input type="file" name="2" size="20" id="2" /&gt;</td>
</tr>
<tr>
  <td align="right" valign="top">Image #3:</td>
  <td colspan="2">&lt;input type="file" name="3" size="20" id="3" /&gt;</td>
  <td align="right">Image #4:</td>
  <td>&lt;input type="file" name="4" size="20" id="4" /&gt;</td>
</tr>
<tr>
  <td align="right" valign="top">Image #5:</td>
  <td colspan="2">&lt;input type="file" name="5" size="20" id="5" /&gt;</td>
  <td align="right">Image #6:</td>
  <td>&lt;input type="file" name="6" size="20" id="6" /&gt;</td>
</tr>
    <tr>
    <td align="right" valign="top">&nbsp;</td>
    <td colspan="4" align="center">&lt;? echo form_submit('submit', 'Submit Images!');?&gt;</td>
  </tr>
</table>
Controller File
Code:
$config['upload_path'] = './imgs/listings/'.$this->input->post('web_id', TRUE).'';
$config['allowed_types'] = 'gif|jpg';
$config['overwrite']  = TRUE;
$config['max_size']    = '2048';
$config['max_width']  = '800';
$config['max_height']  = '600';
$config['remove_spaces']  = TRUE;
    
        $this->load->helper('file');

        $this->load->library('upload', $config);
        
        $this->load->library('email');
        $this->load->library('validation');
mkdir("/home/gainfina/public_html/pre_j/imgs/listings/".$this->input->post('web_id', TRUE)."", 0700);

$data = array('upload_data' => $this->upload->data());

echo $data;
#2

[eluser]Crimp[/eluser]
It can be done. Search the forum for _multiple file upload_ (which is what you are doing). You'll find several answers to your question.
#3

[eluser]RaZoR LeGaCy[/eluser]
I used
Code:
foreach($_FILES as $key => $value){
    if ( ! $this->upload->do_upload($key)){
        // do something here
    }

from post
http://ellislab.com/forums/viewthread/52553/
#4

[eluser]RaZoR LeGaCy[/eluser]
I forgot

Mark as Solved




Theme © iAndrew 2016 - Forum software by © MyBB