473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

php file upload error

Hello,
I'm trying to get the below script working, adapted from the manual on
php.net. Although i am getting success file uploading, i do not see the file
in the tempoary area. And i'm not sure where to go as the server confirms
file uploaded successfully. Any help appreciated.
Thanks.
Dave.

<?php

if (count($_FILES))
{
var_dump($_FILES) ;
}

if (is_uploaded_file($_FILES['UploadFile']['tmp_name']))
{
print "<h3>File successfully uploaded.</h3>" ;
print "<a href=\"{$_SERVER['PHP_SELF']}\">Upload Another?<br>" ;
}
else
{
print <<< __HTMLFORM__
<form enctype="multipart/form-data" action="{$_SERVER['PHP_SELF']}"
method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="10290000">
Filename: <input name="UploadFile" type="file">
<input type="submit" value="upload">
</form>
__HTMLFORM__;
print "<br><a href=\"{$_SERVER['PHP_SELF']}\">Upload Another?<br>" ;
}

?>
Jul 17 '05 #1
2 1996
dave wrote:
I'm trying to get the below script working, adapted from the manual on
php.net. Although i am getting success file uploading, i do not see the file
in the tempoary area.
PHP automatically removes the uploaded file from the temporary directory
when the script ends. You have to put the file somewhere else while you
have control over it.
And i'm not sure where to go as the server confirms
file uploaded successfully. Any help appreciated. <?php

if (count($_FILES))
{
var_dump($_FILES) ;
}

if (is_uploaded_file($_FILES['UploadFile']['tmp_name']))
{
See these links:
http://www.php.net/move_uploaded_file
http://www.php.net/manual/en/features.file-upload.php
print "<h3>File successfully uploaded.</h3>" ;
print "<a href=\"{$_SERVER['PHP_SELF']}\">Upload Another?<br>" ;
}

<snip>

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #2
Hi Dave

From the PHP Help file - handling file uploads section:

"The file will be deleted from the temporary directory at the end of the
request if it has not been moved away or renamed."

use copy($userfile, "/place/to/put/uploaded/file");

or similar to move the file (or just rename it), then you will be able to
see it.

--
Paul Barfoot
"dave" <dm*******@woh.rr.com> wrote in message
news:1R*******************@fe2.columbus.rr.com...
Hello,
I'm trying to get the below script working, adapted from the manual on
php.net. Although i am getting success file uploading, i do not see the
file
in the tempoary area. And i'm not sure where to go as the server confirms
file uploaded successfully. Any help appreciated.
Thanks.
Dave.

<?php

if (count($_FILES))
{
var_dump($_FILES) ;
}

if (is_uploaded_file($_FILES['UploadFile']['tmp_name']))
{
print "<h3>File successfully uploaded.</h3>" ;
print "<a href=\"{$_SERVER['PHP_SELF']}\">Upload Another?<br>" ;
}
else
{
print <<< __HTMLFORM__
<form enctype="multipart/form-data" action="{$_SERVER['PHP_SELF']}"
method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="10290000">
Filename: <input name="UploadFile" type="file">
<input type="submit" value="upload">
</form>
__HTMLFORM__;
print "<br><a href=\"{$_SERVER['PHP_SELF']}\">Upload Another?<br>" ;
}

?>

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
6
by: tshad | last post by:
I have an upload file input as: <input id="MyFile" style="width:300px" type="File" runat="Server"> This works fine, but I find that if my page doesn't pass validation during postback, the page...
1
by: DavidA | last post by:
I have a very simple form and perl script that is to upload a jpg file. I am not familiar with the perl language but copied the code from a text book. It works fine with all browsers except IE....
6
by: Milan Krejci | last post by:
while(list($key,$value) = each($_FILES)) { if(!empty($value)){ $filename = $value; $add = "upimg/$filename"; echo $_FILES; $error=copy($_FILES, $add); if (!$error)...
2
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but...
1
by: chrisj | last post by:
I'm using freeASPupload and got some assistance integrating to a Member script. It works successfully. In this modified version there are two groups that use this upload script. Members of one...
6
Jacotheron
by: Jacotheron | last post by:
I need a PHP script that can upload music files (mp3). The script is for a home project I have started a while ago. I have a MySQL database of all the music that I have. Other computers on the...
5
by: kailashchandra | last post by:
I am trying to upload a file in php,but it gives me error msg please Help me? My Code is like below:- i have one php file named upload.php and i have another html file named upload.html and...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.