Forum Moderators: coopster

Message Too Old, No Replies

Php - Ftp

         

Chris_Coin

6:57 pm on Oct 9, 2005 (gmt 0)

10+ Year Member



My web host doesnt allow me to upload files bigger then 2mb, is ther away around this?

i need to be able to upload files between 7mb - 10mb

this is the php scritp im usinge:
<?php
// FTP Configuration
$FTP_User = "";
$FTP_Pass = "";
$FTP_Host = "example.com";
$FTP_Root = "/public_html/upload";

// If the form was submitted
if ($_POST['Submit']!= "") {

// Connect to the ftp address
$Connect = @ftp_connect($FTP_Host);

// Login
ftp_login($Connect, $FTP_User, $FTP_Pass);

// Set the filename to be uploaded
$Filename = $FTP_Root . $_FILES['File_1']['name'];

// Set the local resource (the file that will be uploaded)
$Local_Resource = $_FILES['File_1']['tmp_name'];

// If the file was successfully uploaded
if (ftp_put($Connect, $Filename, $Local_Resource, FTP_BINARY)) {
// Show success message
echo "Successfully uploaded $Filename<br />";
}
else
{
// Else show error message
echo "There was a problem uploading $Filename<br />";
}
}

// Show the form
echo '<form action="ftp_test.php" method="POST" enctype="multipart/form-data">
<input name="File_1" type="file">
<input type="Submit" name="Submit" value="Upload File(s)">
</form>';
?>

Chris_Coin

10:56 pm on Oct 10, 2005 (gmt 0)

10+ Year Member



If noone knows how to fix this problem is ther someone who can tell me another way to upload files? (with out a file limit)

coopster

11:02 pm on Oct 10, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Hi Chris_Coin, welcome to WebmasterWorld.

If the host doesn't allow file uploads that size or larger you are probably going to run into much bigger issues than just this. My first recommendation would be to look around for alternatives. However, that said, what is the issue? Are you able to use the script here successfully? If not, what error messages are you receiving?

FTP or other solutions are available and I see you are considering an FTP possibility. You might look into PHP's FTP Functions [php.net] or fsockopen() [php.net].

Chris_Coin

3:06 pm on Oct 11, 2005 (gmt 0)

10+ Year Member



the script im using works, no errors

the only problem im having is uploading files from my webpage that are larger then 2mb,

i was told this was because of the php.ini, i cannot edit this file only my webhost can and they said no to letting me upload larger files.

im running windows 2000 on my home computer, i have set up an ftp server and uploaded the files. it works but i still i cannot upload files larger then 2mb.

coopster

5:10 pm on Oct 11, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Well, you are correct in that if your host is not going to allow files any larger to be uploaded you could try all day long and it just isn't going to work with a <form>. That particular configuration directive cannot be overridden.

The only way the FTP option is going to work is if you have an FTP server you can connect to and get the files. My advice at this point would be to get a different hosting provider or a dedicated server. Others may differ, but that is the route I would take.

Chris_Coin

8:12 pm on Oct 11, 2005 (gmt 0)

10+ Year Member



ive been browsing the net for days and i finally found a solution to my problem, i found a way for .htaccess to override the php.ini settings, i can upload anyfile size i want now...

thanks for all the help

vincevincevince

8:17 pm on Oct 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Chris... I thought I told you I didn't want you uploading more than 2Mb... you can kiss your account goodbye in about 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ... seconds.... just kidding - (am nothing to do with your host, that I know of)

coopster

8:55 pm on Oct 11, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




That particular configuration directive cannot be overridden.

I can honestly tell you that I have no idea what I was thinking this morning when I said that ;) Must have been thinking ini_set() ... Anyway, glad you got it sorted, Chris_Coin.

A past thread that lists some of the other directives you may want to watch ...

[webmasterworld.com...]