File uploading issue - file uploads on browser refresh
Posted: Thu Aug 10, 2006 4:55 am
Pimptastic | Please use
PHP file:
php.ini values:
I have tried with upload_tmp_dir = "c:\winnt\temp\" also but the issue remains the same.
Regards,
Rifat
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello All,
I am using the following code to upload file to server. I am having a strange problem that the file does not
upload the first time PHP is called from HTML form, when he browser is refreshed i.e. the script is executed again
the file gets uploaded to the desired location. Please help me solve my problem.
HTML Form:Code: Select all
<FORM ACTION="fileUpload1.php" METHOD=POST ENCTYPE="multipart/form-data">
<INPUT TYPE="file" NAME="uploadedfile" SIZE=30>
<INPUT TYPE="submit" VALUE="Upload File">
</FORM>PHP file:
Code: Select all
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '../';
$uploadfile = $uploaddir . basename($_FILES['uploadedfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>Code: Select all
file_uploads = On
;upload_tmp_dir =
upload_max_filesize = 2MRegards,
Rifat
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]