473,395 Members | 1,537 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,395 software developers and data experts.

Uploads matters....

Hi everybody!

I could use a little explaination here!

I spent quite a few hrs yesterday evening coding
the script behind a form to upload a picture, and
I think it does what it is supposed to do, but I'm
not too happy with my understanding of the features
available in php to deal with this issue.

Question #1
If the field in the form is not empty but the file
does not exist on the client's hard drive, the variable
$_FILES[filename][error] and $_FILES[filename][size]
are both set to zero. But how do I discern between a
file that is not existant and a transfer that for some
strange reason has not yet written anything on the
server side?

Question #2
Once the user click on the submit button, the transfer
seems to start right away, and the next page is shown
only when the transfer actually ends.
Is there any way to avoid this? I'd like instead to
show the first part of the page, wait for the transfer
to finish, and only then continue with the generation
of the rest of the page. Is this possible?

Thanks for your help.

Manu
Jul 17 '05 #1
2 1508

"Emanuele D'Arrigo" <ma****@mclink.it> wrote in message news:42**************************@posting.google.c om...
Hi everybody!

I could use a little explaination here!


The PHP script which receives the uploaded file should implement whatever logic is necessary for determining what should be done with the uploaded file. You can, for example, use the $_FILES['userfile']['size'] variable to throw away any files that are either too small or too big. You could use the $_FILES['userfile']['type'] variable to throw away any files that didn't match a certain type criteria. As of PHP 4.2.0, you could use $_FILES['userfile']['error'] and plan your logic according to the error codes. Whatever the logic, you should either delete the file from the temporary directory or move it elsewhere.

If no file is selected for upload in your form, PHP will return $_FILES['userfile']['size'] as 0, and $_FILES['userfile']['tmp_name'] as none.

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

____________________________________
Wil Moore III, MCP | Integrations Specialist | Assistant Webmaster
Jul 17 '05 #2
Thanks Wil for your answer.

Strangely, the $_FILES['filename']['tmp_name'] didn't seem to return "none",
only an empty string instead. But I can handle that.

Any hint about my second question?

Manu
Jul 17 '05 #3

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

Similar topics

7
by: OneSolution | last post by:
Hi All, Here's one thing that I don't know much about - file uploading. As part of my project, I will have to build a file manager of sorts - perhaps a document manager. Anyhow, this involves...
1
by: Doug Helm | last post by:
I should have been more clear in my subject line. I was also the poster in the "File Uploads" topic. I'm not having any luck getting file uploads to work (multi-part HTML form) on a Windows...
6
by: nwheavyw8 | last post by:
I am currently trying to write a simple PHP script that will split an uploading file up into 500kb "chunks", then read and concatenate them back together when accessed for download. I can't seem...
2
by: Buddy Ackerman | last post by:
I'm have Windows 2000 Server and my website allows uploads of files (using <input type="file">) However I have some problems when a user trys to upload a large (>8MB) file. When the user submits...
0
by: François Lemaire | last post by:
I've already posted this question on the IIS forum, but it seems the problem is not IIS related. I have an ASP.NET application that does big uploads on the server (around 50Mo-100Mo). It works...
12
by: JMB | last post by:
Hello, I was wondering if anyone knew of any projects extending the inline upload progress bar to utilize an inpage image uploader with bar, without having to refresh or go to a seperate page,...
4
by: Steven | last post by:
I have a situation where I need to upload more than one file from a client to the server, I am having problems finding any examples of how I can ahhieve my goal. My Requirements are: 1, There...
4
by: mcrose | last post by:
I've written theh standard applicaiton for our client to allow indexed (customer name, subject etc) file uploads via secure http using the <input type='file'http element. This works great, and has...
9
by: Jankie | last post by:
<?php if(isset($_POST) && $_FILES > 0){ foreach ($_FILES as $key => $error) { $name = $_FILES; $tempname = $_FILES; ………… ……… $path = 'uploads/'; include 'dbcon.php'; $rep = strpos($_FILES,...
0
by: ProgrammerChicago | last post by:
My website is for uploading of large files. We've had some 20-30 mb uploads already. Uploads any larger caused the site to timeout afterwards. So, am I correct that I should raise the timeout...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.