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

File upload not working but no error...

Hello,

I have a file upload page, and I've had it working fine, it was
beautiful :-) Anyway, the powers that be moved hosts... and it doesn't
work now.

The file name is correct, the directory where it's going on the
server is correct (checked through prints etc.). I've changed the dir
to 777 (is that right?) and this is what I get on the
print_r($_FILES); line:

Array
(
[userfile] => Array
(
[name] => amy.txt
[type] => text/plain
[tmp_name] => /tmp/phpccPHUE
[error] => 0
[size] => 39
)

)

And the file is not uploading - I'm getting an error on the line:

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
And yet, you'll notice the line above clearly states I get '0'
error?!?!

I can't work it this one out... any helpful hints? Please?

Many many thanks,

Amy
Jul 17 '05 #1
3 7068
Amy Kimber wrote:
Hello,

I have a file upload page, and I've had it working fine, it was
beautiful :-) Anyway, the powers that be moved hosts... and it doesn't
work now.

The file name is correct, the directory where it's going on the
server is correct (checked through prints etc.). I've changed the dir
to 777 (is that right?) and this is what I get on the
print_r($_FILES); line:

Array
(
[userfile] => Array
(
[name] => amy.txt
[type] => text/plain
[tmp_name] => /tmp/phpccPHUE
[error] => 0
[size] => 39
)

)

And the file is not uploading - I'm getting an error on the line:

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))

<snip>

What is the value of $uploadfile?
Jul 17 '05 #2

"Agelmar" <if**********@comcast.net> wrote in message
news:c4*************@ID-30799.news.uni-berlin.de...
Amy Kimber wrote:
Hello,

I have a file upload page, and I've had it working fine, it was
beautiful :-) Anyway, the powers that be moved hosts... and it doesn't
work now.

The file name is correct, the directory where it's going on the
server is correct (checked through prints etc.). I've changed the dir
to 777 (is that right?) and this is what I get on the
print_r($_FILES); line:

Array
(
[userfile] => Array
(
[name] => amy.txt
[type] => text/plain
[tmp_name] => /tmp/phpccPHUE
[error] => 0
[size] => 39
)

)

And the file is not uploading - I'm getting an error on the line:

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))

<snip>

What is the value of $uploadfile?


And what is the error?
Jul 17 '05 #3
"Chung Leong" <ch***********@hotmail.com> wrote in message news:<ef********************@comcast.com>...
"Agelmar" <if**********@comcast.net> wrote in message
news:c4*************@ID-30799.news.uni-berlin.de...
Amy Kimber wrote:
Hello,

I have a file upload page, and I've had it working fine, it was
beautiful :-) Anyway, the powers that be moved hosts... and it doesn't
work now.

The file name is correct, the directory where it's going on the
server is correct (checked through prints etc.). I've changed the dir
to 777 (is that right?) and this is what I get on the
print_r($_FILES); line:

Array
(
[userfile] => Array
(
[name] => index.html
[type] => text/plain
[tmp_name] => /tmp/phpccPHUE
[error] => 0
[size] => 39
)

)

And the file is not uploading - I'm getting an error on the line:

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) <snip>

What is the value of $uploadfile?

$uploadfile = $uploaddir . $_FILES['userfile']['name'];

which comes out as...

/web/demo/translation/index.html

which seems correct,
And what is the error?


that's just hte point, [error] => 0 - but the line that's throwing the
error is:

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{

I have had this code working before on another server, so what am I
doing wrong? Please! Any comments at all would be useful!

:-)

Many thanks,

Amy
here's the whole code

---------------------

<?php

session_start();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>File upload</title>

<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />

</head>

<?php

// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used
instead

// of $_FILES. In PHP versions earlier than 4.0.3, use copy() and

// is_uploaded_file() instead of move_uploaded_file.
$uploaddir = '/web/demo/translation/';

$uploadfile = $uploaddir . $_FILES['userfile']['name'];

print ($uploadfile);
print ($_FILES['userfile']['name']);
print "<pre>";
print_r($_FILES);
print ("name: " . $uploadfile);

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{

$msg = "File (" . $_FILES['userfile']['name'] . ") is valid, and
was successfully uploaded. ";

//print_r($_FILES);
$jobid = time();
$rename = $jobid . $_FILES['userfile']['name']; //or $rename =
$username;
$file_name = $_FILES['userfile']['name'];
$read_extension = explode(".", $file_name);
$ext = $read_extension[1];
//$rename = $rename.".".$ext;
rename($file_name, $rename);
$info = array($rename, $_FILES['userfile']['type']);
session_register('info');
session_start();
} else {
$msg = "File did not upload successfully, close window and try
againn";
$msg = $msg . print_r($_FILES);
}

?>

<BODY bgColor=#ffffff >
etc. etc.

----------------------

and the output is this:

------------

/web/demo/translation/index.html
index.html
Array
(
[userfile] => Array
(
[name] => index.html
[type] => text/html
[tmp_name] => /tmp/phpEyvvil
[error] => 0
[size] => 477
)

)
name: /web/demo/translation/index.html

Array
(
[userfile] => Array
(
[name] => index.html
[type] => text/html
[tmp_name] => /tmp/phpEyvvil
[error] => 0
[size] => 477
)

)
Upload File File did not upload successfully, close window and try
againn1
Jul 17 '05 #4

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

Similar topics

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...
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: jf li | last post by:
I have a Asp.net web application and a Asp.net Web service application. The Web application is using HtmlInputFile to get a 50M size of file selected by end user, read the data of this file and...
8
by: mpar612 | last post by:
Hello, I am a newbie to PHP, MySQL. I am trying to create a basic file upload form. I want to get that working and then I want to integrate that into a form that will rename the file and save...
1
by: igotyourdotnet | last post by:
Ok, here is the issue: I have 2 web pages one does a file upload to a database and the other page does a FTP to a server, both pages use the c:\temp directory. The page that uploads to a database...
3
by: markus.rietzler | last post by:
i want to do (multiple) file upload(s) and display a progress bar. with firefox and safari it is no problem at all. only IE makes some problems. my script is based on ajax-uploader, which can be...
4
cassbiz
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of...
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...
3
by: wassimdaccache | last post by:
Dear sirs, It is shame to me to say that I have been 1 week working in this problem and it is not working. I am getting this error while I am uploading a file using my website. Warning:...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.