472,992 Members | 3,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Partially Uploading Files via PHP


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 find this:
(000001) 24/03/2006 09:17:32 - dean ( > logged in.
(000001) 24/03/2006 09:17:32 - dean ( > 230 User dean logged
(000001) 24/03/2006 09:17:32 - dean ( > TYPE I
(000001) 24/03/2006 09:17:32 - dean ( > 200 Type set to I.
(000001) 24/03/2006 09:17:33 - dean ( > SIZE
(000001) 24/03/2006 09:17:33 - dean ( > 550 No such file or
(000001) 24/03/2006 09:17:33 - dean ( > EPSV
(000001) 24/03/2006 09:17:33 - dean ( > 500 Unknown command.
(000001) 24/03/2006 09:17:33 - dean ( > PASV
(000001) 24/03/2006 09:17:33 - dean ( > 227 Entering Passive
Mode (127,0,0,1,33,225)
(000001) 24/03/2006 09:17:33 - dean ( > STOR
(000001) 24/03/2006 09:17:33 - dean ( > asked to upload
'\system\uploads\c1d58880229e579b1a05a4c1aee35e71D oc1.doc' in
'C:\Server\Apache Group\Apache2\htdocs\' --> Access allowed.
(000001) 24/03/2006 09:17:33 - dean ( > 150 Data connection
accepted from; transfer starting for
(000001) 24/03/2006 09:17:33 - dean ( > started uploading
'\system\uploads\c1d58880229e579b1a05a4c1aee35e71D oc1.doc' in
'C:\Server\Apache Group\Apache2\htdocs\'.
(000001) 24/03/2006 09:17:33 - dean ( > QUIT
(000001) 24/03/2006 09:17:33 - dean ( > 221 Bye bye ...
(000001) 24/03/2006 09:17:33 - dean ( > aborted uploading
'\system\uploads\c1d58880229e579b1a05a4c1aee35e71D oc1.doc' in
'C:\Server\Apache Group\Apache2\htdocs\' - (00:00:01 - 7.031 KB -
7.031 KBytes/s).
(000001) 24/03/2006 09:17:33 - dean ( > file partially
uploaded : 'C:\Server\Apache
Group\Apache2\htdocs\system\uploads\c1d58880229e57 9b1a05a4c1aee35e71Doc1.do*c'

(000001) 24/03/2006 09:17:33 - dean ( > disconnected.
For some reason, I can run my PHP script on a third party server and it

works OK, so something tells me that I am missing something.
The php script is below:
$uploaddir = init_upload_imports();
//copy the file to some permanent location
if (move_uploaded_file($_FILES["userfile"]["tmp_name"], $uploaddir .
echo ("error!");
Any help would be very much appreciated.
Thanks in Advance.

Mar 28 '06 #1
3 2006
Dean Richardson wrote:

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.

Probably timing out. Tune the upload params in your php.ini.

Mar 28 '06 #2

I checked the phpinfo and cannot find anything out of the ordinary. The
upload times out in one second or thereabouts.
I have included the phpinfo below.

allow_call_time_pass_reference On
allow_url_fopen On
always_populate_raw_post_data Off
arg_separator.input &
arg_separator.output &
asp_tags Off
auto_append_file no value
auto_prepend_file no value
browscap no value
default_charset no value
default_mimetype text/html
define_syslog_variables Off
disable_classes no value
disable_functions no value
display_errors On
display_startup_errors Off
doc_root no value
docref_ext no value
docref_root no value
enable_dl On
error_append_string no value
error_log no value
error_prepend_string no value
error_reporting 2047
expose_php On
extension_dir ./
file_uploads On
gpc_order GPC
highlight.bg #FFFFFF
highlight.comment #FF8000
highlight.default #0000BB
highlight.html #000000
highlight.keyword #007700
highlight.string #DD0000
html_errors On
ignore_repeated_errors Off
ignore_repeated_source Off
ignore_user_abort Off
implicit_flush Off
include_path .;c:\php4\pear
log_errors Off
log_errors_max_len 1024
magic_quotes_gpc On
magic_quotes_runtime Off
magic_quotes_sybase Off
max_execution_time 60
max_input_time 60
open_basedir no value
output_buffering no value
output_handler no value
post_max_size 8M
precision 12
register_argc_argv On
register_globals Off
report_memleaks On
safe_mode Off
safe_mode_exec_dir no value
safe_mode_gid Off
safe_mode_include_dir no value
sendmail_from me@localhost.com
sendmail_path no value
serialize_precision 100
short_open_tag On
SMTP localhost
smtp_port 25
sql.safe_mode Off
track_errors Off
unserialize_callback_func no value
upload_max_filesize 8M
upload_tmp_dir C:\Server\PHP\uploadtemp
user_dir no value
variables_order EGPCS
xmlrpc_error_number 0
xmlrpc_errors Off
y2k_compliance On

Apr 3 '06 #3
> However, text files upload OK.

Try FTP's binary mode for binary files. You can find the file's
MIME-type in $_FILES['...']['type'].
If it starts with text/... you can transfer in ASCII mode as you seem
to do now.

Apr 3 '06 #4

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

Similar topics

by: dickiedyce | last post by:
Hi there. I've spent the weekend getting ever more frustrated, trying to get an upload file function working on a website. The site is hosted by a company called oneandone. They're using PHP...
by: geradeaus | last post by:
Even if you upload an image partially with ftp software, you can still read the image. Only the image will be partially gray. So, can I determine with a php-function if an image is fully uploaded...
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
by: SoSaucily | last post by:
I am getting the 'partially uploaded file' error with uploads over about 4k-5k. $_FILE = 3. Rackin my brain on this one, any help appreciated. Php.ini - upload_max_filesize=2M -...
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...
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
by: =?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?= | last post by:
jodleren escribió: I haven't found the PHP manual page where such feature is documented but a few tests have shown that this behaviour changes depending on the charset parameter of the...
by: muziburrehaman | last post by:
i am looking for code in php to upload the 1 gb files. any one can please help me by sending the code....
by: LoriFranklin | last post by:
I'm a bit of a newbie here. I've learned a lot from reading the posts you all have here. I need some help uploading files using an asp form. I am using some code that I found from Jacob at...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.