help about big files upload via html form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MysticRoad
Forum Newbie
Posts: 8
Joined: Mon Oct 03, 2005 1:46 pm

help about big files upload via html form

Post by MysticRoad »

hi guys
i have a problem in uploading a big file like .mp3 files (e.g 5 MB)
I'm using a "copy" function but no result it's failure !
Can u help me to do this ?
thx


feyd | posting does not require a size 18 font.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you could easily be hitting the upload/post maximum sizes set for your installation.. check that all the ini config settings listed on the file uploading helper page are set correctly.

http://php.net/features.file-upload
MysticRoad
Forum Newbie
Posts: 8
Joined: Mon Oct 03, 2005 1:46 pm

Post by MysticRoad »

my hosting dont want to change upload max file size in php.ini
what can I do ?
I 'm traying with ftp functions
but I cant do it
can u help me ???
thx
User avatar
chrys
Forum Contributor
Posts: 118
Joined: Tue Oct 04, 2005 9:41 am
Location: West Roxbury, MA (Boston)

Post by chrys »

MysticRoad wrote:my hosting dont want to change upload max file size in php.ini
what can I do ?
I 'm traying with ftp functions
but I cant do it
can u help me ???
thx
How do know the FTP functions are not working? Please provide more info
MysticRoad
Forum Newbie
Posts: 8
Joined: Mon Oct 03, 2005 1:46 pm

Post by MysticRoad »

Code: Select all

<?
$file = 'C:\AppServ\www\aparank\images\upimages\01.mp3';
$remote_file = '01.mp3';
$ftp_server='';
$ftp_user_name='';
$ftp_user_pass='';
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY)) {
print "successfully uploaded $file\n";
} else {
print "There was a problem while uploading $file";
}
ftp_close($conn_id);
?>
this is my source
I want to upload '01.mp3' to my server
can u show me my problems ?
User avatar
chrys
Forum Contributor
Posts: 118
Joined: Tue Oct 04, 2005 9:41 am
Location: West Roxbury, MA (Boston)

Post by chrys »

MysticRoad wrote:

Code: Select all

<?
$file = 'C:\AppServ\www\aparank\images\upimages\01.mp3';
$remote_file = '01.mp3';
$ftp_server='';
$ftp_user_name='';
$ftp_user_pass='';
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY)) {
print "successfully uploaded $file\n";
} else {
print "There was a problem while uploading $file";
}
ftp_close($conn_id);
?>
this is my source
I want to upload '01.mp3' to my server
can u show me my problems ?
What is the output that you get from this code?
MysticRoad
Forum Newbie
Posts: 8
Joined: Mon Oct 03, 2005 1:46 pm

Post by MysticRoad »

Code: Select all

Warning: ftp_put(C:\AppServ\www\aparank\images\upimages\01.mp3) [function.ftp-put]: failed to open stream: No such file or directory in /home/acxxnlkk/public_html/ftp2.php on line 14
There was a problem while uploading C:\AppServ\www\aparank\images\upimages\01.mp3
User avatar
chrys
Forum Contributor
Posts: 118
Joined: Tue Oct 04, 2005 9:41 am
Location: West Roxbury, MA (Boston)

Post by chrys »

MysticRoad wrote:

Code: Select all

Warning: ftp_put(C:\AppServ\www\aparank\images\upimages\01.mp3) [function.ftp-put]: failed to open stream: No such file or directory in /home/acxxnlkk/public_html/ftp2.php on line 14
There was a problem while uploading C:\AppServ\www\aparank\images\upimages\01.mp3
Unless the PHP script is running from your local computer... you can't upload anything from your local computer using these FTP functions. The FTP functions are designed to allow the machine that the code is being executed from to upload to another machine. That is why it can't find the file, because it doesn't exist.
MysticRoad
Forum Newbie
Posts: 8
Joined: Mon Oct 03, 2005 1:46 pm

Post by MysticRoad »

ok dear freind
in this case what can I do to upload a big file from my local computer to the web hosting using a html form
when my hoster dont want to change a upload max file size in "php.ini" value !
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

php.ini directives wrote:post_max_size "8M" PHP_INI_PERDIR PHP_INI_SYSTEM in PHP <= 4.2.3. Available since PHP 4.0.3.
------------
upload_max_filesize "2M" PHP_INI_PERDIR PHP_INI_ALL in PHP <= 4.2.3.
both state that you can change them on a per directory basis.. to using an .htaccess file you should be able to change it.

http://php.net/configuration.changes
MysticRoad
Forum Newbie
Posts: 8
Joined: Mon Oct 03, 2005 1:46 pm

Post by MysticRoad »

I have input this code in .htaccess
upload_max_filesize "10M" PHP_INI_PERDIR PHP_INI_ALL
now my web site show internal server error 500 :cry:
can u explain me with more info ???????
MysticRoad
Forum Newbie
Posts: 8
Joined: Mon Oct 03, 2005 1:46 pm

Post by MysticRoad »

I have try this

Code: Select all

<IfModule mod_php5.c>
php_value include_path ".:/usr/local/lib/php"
php_value upload_max_filesize 10M
</IfModule>
in .htaccess file
but its show again upload_max_filesize 2M in phpinfo()
what must I do ?
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

You're host really has PHP 5 in a shared environment? Didn't know you could get that... Look closely at your .htaccess directive.... Sorry I don't know the proper module name for PHP 4 offhand
MysticRoad
Forum Newbie
Posts: 8
Joined: Mon Oct 03, 2005 1:46 pm

Post by MysticRoad »

yes my host has php5 u can see it on http://mysticroad.com/info.php
what code must I write ?
User avatar
phpdevuk
Forum Contributor
Posts: 220
Joined: Mon Jul 04, 2005 5:31 am
Location: UK
Contact:

Post by phpdevuk »

I found this little applet a while ago for handling multiple uploads at the same time, it pretty cool http://jupload.biz/en_2.html
Post Reply