Page 1 of 1

File Uploads Can not be Opened

Posted: Wed Jan 08, 2003 6:24 pm
by justravis
Getting these errors:
Warning: Unable to open 'file1' for reading: No such file or directory in /home/clinical/public_html/admin/journal/article/art4/add_files.phps on line 18

Warning: Unable to open 'file2' for reading: No such file or directory in /home/clinical/public_html/admin/journal/article/art4/add_files.phps on line 18

Warning: Unable to open 'file3' for reading: No such file or directory in /home/clinical/public_html/admin/journal/article/art4/add_files.phps on line 18

Warning: Unable to open 'file4' for reading: No such file or directory in /home/clinical/public_html/admin/journal/article/art4/add_files.phps on line 18

Warning: Unable to open 'file5' for reading: No such file or directory in /home/clinical/public_html/admin/journal/article/art4/add_files.phps on line 18

Already fixed issue with upload_tmp_dir not being set.

Any other ideas?

Here is the code:

Code: Select all

<h3>Add Files:</h3>
<form method=post action=<?php echo $PHP_SELF . "?artid=$artid" ?> enctype='multipart/form-data'>
<b>*Filenames can only have alphanumeric symbols and underscores (_). No spaces.</b><br>

&#1111;php]
<?php

$file_fields_count=5;

#File Uploads
if(isset($_POST&#1111;upload]))
&#123;
        for($i=1; $i<=$file_fields_count; $i++)
        &#123;
                $file="file$i";

                if($file)
                &#123;
                        copy($file, "$curfilespath/$file_name");

                        if($i==1 && isset($_POST&#1111;pdf]))
                        &#123;
                                mysql_query("UPDATE article SET pdf=$file_name WHERE id=$artid");
                        &#125;
                &#125;
                else
                &#123;
                        unlink($file);
                &#125;
        &#125;
&#125;

#File Fields Output
for($i=1; $i<=$file_fields_count; $i++)
&#123;
        $fieldname= 'file' . $i;

        echo "\t<input type=file name=$fieldname size=50><br>\n";

        if($i==1)
        &#123;
                echo "\t<input type=checkbox name=pdf>PDF version of the article.<br>\n";
        &#125;
&#125;

?>&#1111;/php]
        <input type=submit name=upload value=Upload>
</form>

Posted: Wed Jan 08, 2003 7:04 pm
by volka