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

Upload file that does not exist

I have a form:

<form method="post" action="res_addaresource.php" name="frm1"
enctype="multipart/form-data" onsubmit="return checkFields();">

with a file object:

<input name="localfile" id="localfile" type="file" size="68">

to upload a file.

I click the Browse button and select a file on my hard disk. Then I
delete or rename the file on my hard disk. When I then submit the
form

$uploaded = move_uploaded_file($_FILES['localfile']['tmp_name'],
$uploadfile);

returns true and $_FILES['userfile']['error'] does not return an error
(it returns the empty string which I guess means 0).

The only way to detect something fishy is going on is looking at
$_FILES['localfile']['size'] that returns 0.

Is this the way things are supposed to be? I would want $uploaded to
be false.

Regards,

Jan Nordgreen

Oct 29 '07 #1
1 2153
On Mon, 29 Oct 2007 21:52:25 +0100, damezumari <ja**********@gmail.com
wrote:
I have a form:

<form method="post" action="res_addaresource.php" name="frm1"
enctype="multipart/form-data" onsubmit="return checkFields();">

with a file object:

<input name="localfile" id="localfile" type="file" size="68">

to upload a file.

I click the Browse button and select a file on my hard disk. Then I
delete or rename the file on my hard disk. When I then submit the
form

$uploaded = move_uploaded_file($_FILES['localfile']['tmp_name'],
$uploadfile);

returns true and $_FILES['userfile']['error'] does not return an error
(it returns the empty string which I guess means 0).

The only way to detect something fishy is going on is looking at
$_FILES['localfile']['size'] that returns 0.

Is this the way things are supposed to be? I would want $uploaded to
be false.
Well, the UA should issue the warning/block on a submit (Opera does BTW,
with a nice inline explanation next to the input element, FF & MSIE
don't). There's no way you can know it's not supposed to be an empty file,
which it could be. Empty files are used quite regularly for genuine
purposes.
--
Rik Wasmus
Oct 29 '07 #2

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

Similar topics

10
by: matt | last post by:
I have this code, works perfectly on Windows server, but now i'm trying to run it on a Linux server, the form submits, i get no errors, but the photo doesnt upload, and the caption file doesnt...
1
by: Kristian | last post by:
The script below uploads the selected file and creates it on the server in the right directory and all looks fine. But the file is empty, it contains nothing... HTML FORM: <form name="foo"...
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
4
by: Matt Jensen | last post by:
Howdy I've got a rather strange issue occuring. I used forms based .NET authentication, although I'm also setting some session variables when people login. However, I've found when people use...
16
by: lawrence k | last post by:
I've a file upload script on my site. I just now used it to upload a small text document (10k). Everything worked fine. Then I tried to upload a 5.3 meg Quicktime video. Didn't work. I've...
1
by: Alex | last post by:
I am having issues with a script to upload files from a client to a webserver. The problem is not with the actual upload but with where it uploads. The whole process is supposed to create a...
9
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
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)...
3
by: premprakashbhati | last post by:
hi, good evening.. i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button() here is the code ...its work fine...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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: 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...

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.