Forum Moderators: coopster
About week ago file uploading stopped working on my server. It worked perfectly with my PHP script, but now it doesn't.
The problem is NOT in script, because I've tried simple one and it doesn't work too:
<?php
if(isset($_POST['submit'])){
$userdir = "/home/user/photos/";
$filein = $userdir . $_FILES['url']['name'];
copy($_FILES['url']['tmp_name'], $filein);
}
?><form action="up.php" method="post" enctype="multipart/form-data">
<p>
<b>Choose photo:</b>
<input name="url" type="file" /><br />
<input type="submit" name="submit" />
<input type="reset" />
</p></form>
Also, the problem is not in permissions as copy command works:
copy("/home/user/photos/1.jpg", "/home/user/photos/1111.jpg");
I have this lines in my php.ini (I didn't change anything from when it worked):
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;; Whether to allow HTTP file uploads.
file_uploads = On; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
PHP scripts do not print any error message (error reporting is On in php.ini and in script). Also, there is no any errors in log file.
I wonder how can I fix it? I killed few days on this and still can't understand why it stopped working.
When I do "ls -a", I can't see any uploaded files.
Also, I've added this line into my PHP script:
print_r($_FILES);
I get this:
Array ( [url] => Array ( [name] => 1038515685_36c6fd93f7_o.jpg [type] => image/jpeg [tmp_name] => /tmp/php0MpikH [error] => 0 [size] => 513076 ) )