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

Partially Uploading Files via PHP

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

deleted.
(000001) 24/03/2006 09:17:33 - dean (127.0.0.1) > disconnected.
(00:00:00)
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 .
$custno.$_FILES["userfile"]["name"]))
{
$v_attachments=$custno.$_FILES["userfile"]["name"];
}
else
{
echo ("error!");
}
Any help would be very much appreciated.
Thanks in Advance.
Dean

Mar 28 '06 #1
3 2037
Dean Richardson wrote:
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.

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

<http://www.radinks.com/upload/config.php>
Mar 28 '06 #2
Hi,

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.

Thanks,
Dean.
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

4
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...
1
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...
5
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...
2
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 -...
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...
221
Atli
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...
2
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...
3
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....
0
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...
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...
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.