473,327 Members | 2,118 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,327 software developers and data experts.

Uploading Script!

i have a script that runs ok on the lycos webserver, but due to it
being unreliable, i've moved to another free server for testing. the
script is as follows:

PHP Code:
<?php

$store_dir = BASE_DIR."gallery/images/";

#check if the string of the file name given is more than one.
if( strlen($_POST['upfile']['name']) < 1 )
{
echo("Error! No files to upload... Exiting");
exit();
}
#check the directory exists
if( !is_dir($store_dir) )
{
echo("Specified directory is not valid... Exiting");
@unlink($_POST['upfile']['tmp_name']);
exit();
}
#copying the file
if( @copy($_POST['upfile']['tmp_name'] ,
$store_dir.$_POST['upfile']['name'] ) )
{
echo("Uploaded ".$_POST['upfile']['name']." successfully.");
}
else
{
echo("Upload of ".$_POST['upfile']['name']." to ".$store_dir."
failed!!!!<BR>");
}
@unlink($_POST['upfile']['tmp_name']);
echo BASE_DIR;
?>
and form:

PHP Code:
<head><body>
<form enctype="multipart/form-data" action="do_upload.php"
method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="8192">
<input name="upfile" type="file">
<input name="store_dir" type="hidden" value="/images/">
<input type="submit" value="Send File">
<input type="reset" value="reset">
</form>
</body></head>
but the problem is, the postdata is not being read by the script as it
exits at the first IF statement saying there is no file.

anyhelp?

thanks!

Jul 17 '05 #1
0 1071

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

Similar topics

6
by: Chamomile | last post by:
can anyone point me to some straightforward information on file uploading without using an html form? That is, direcly from within a php script. if I know the local path etc. to a particular...
4
by: msnews.microsoft.com | last post by:
Hi, I hope we can upload only files with limited size through ASP scripts(<2MB). I need to write an ASP script that can serve up to 100MB of file uploading. I have written one script(with...
4
by: Chris Dewin | last post by:
How do I go about writing a cgi script, that will enable the client to upload things to a directory on my website? I would also like to write a script that enables the client to delete items in...
3
by: Dean Richardson | last post by:
Hi, I'm having trouble uploading files via a PHP script. Whenever I upload a file greater than 10K, the file gets corrupted. However, text files upload OK. When I check the FTP Server log I...
2
by: Joseph0 | last post by:
For the purpose of this thread, here is the scenario: 100 people are uploading 500 MB files at the same time. Each person has the exact computer configurations and same Internet connections. Which...
1
by: thulaseeram | last post by:
I am using iframe to store uploaded images, it is uploading fine in IE but it is not happening in firefox means first time it is uploading image if i try to upload second image it is not calling even...
7
by: dasrasmikant | last post by:
Dear Experts, I am falling in a trouble and need your help for solving it I want to get the width and heignt of an image before uploading it. Below is my code <script language="javascript">...
10
by: =?Utf-8?B?RGFu?= | last post by:
I'm using a pure ASP upload script to handle file uploading. We run IIS6 and I'm aware of the AspMaxRequestEntityAllowed variable in the metabase. I upped this to allow the file size maximum and it...
1
by: Piotrekk | last post by:
Hi My application is uploading the file to the ASP script. I am dealing with situation where ASP script is not interested in receiving a file. I simulate this by returning from ASP script: ...
11
by: starter08 | last post by:
Hi, I have a C++ function which sends a post request to a server for uploading a file. I have also written a server side cgi to receive the data and create the file in a specified directory. The...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.