Forum Moderators: coopster
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>';
?>
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].
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.
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.
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...]