Results 1 to 2 of 2
I've wriiten a PHP script wich upload three files thru a POST form. Here is the form code:
Code:
echo "<form method=\"POST\" enctype=\"multipart/form-data\">";
echo "<table>";
echo "<tbody>";
/* Media upload ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-16-2005 #1Linux User
- Join Date
- Aug 2005
- Location
- Italy
- Posts
- 401
PHP upload apparently works, but...
I've wriiten a PHP script wich upload three files thru a POST form. Here is the form code:
When the page is loaded, a function will call the dedicated routine to performe file upload:Code:echo "<form method=\"POST\" enctype=\"multipart/form-data\">"; echo "<table>"; echo "<tbody>"; /* Media upload form */ echo "<tr>"; echo "<td>"; echo " <select name=\"media_to_del\" size=\"20\">"; $list = wiew_get_sources(); foreach ($list as $media) echo "<option value=\"$media\">$media</option>"; unset($list); echo " </select>"; echo "</td>"; echo "<td valign=\"top\">"; echo " Media name: <input name=\"title\" type=\"text\"> "; echo " Left video file: <input name=\"lv_source\" type=\"file\"> "; echo " Right video file: <input name=\"rv_source\" type=\"file\"> "; echo " Audio file: <input name=\"a_source\" type=\"file\"> "; echo " <button name=\"media_upload\" type=\"submit\">Upload</button>"; echo " "; echo " <button name=\"media_delete\" type=\"submit\">Delete</button>"; echo "</td>"; echo "</tr>"; echo "</tbody>"; echo "</table>"; echo "</form>";
Effectively the script works, but only on small files... I've checked it. I've edited on /etc/php/apache2/php.ini the following directives:Code:/* This routine will upload all files needed and move them in the media repository. This routine requires the following variables: - $_FILES['lv_source'] - $_FILES['rv_source'] - $_FILES['a_source'] - $_POST['title'] Audio source is not required. The directory will be created under $GLOBALS['media_prefix'] using the title specified. Uploaded file will be named: - LVIDEO.mpg for left video source. - RVIDEO.mpg for right video source. - AUDIO.wav for audio source (if any). */ function wiew_media_upload() { global $errdescr; /* Check variables */ if (strlen($_POST['title']) == 0) { $errdescr = "You haven't specified the media title."; utils_show_error($errdescr); return (FALSE); } if (strlen($_FILES['lv_source']['tmp_name']) == 0) { $errdescr = "You haven't specified the left video source."; utils_show_error($errdescr); return (FALSE); } if (strlen($_FILES['rv_source']['tmp_name']) == 0) { $errdescr = "You haven't specified the right video source."; utils_show_error($errdescr); return (FALSE); } if (!is_uploaded_file($_FILES['lv_source']['tmp_name'])) { $errdescr = "Failed to upload files (left video)."; utils_show_error($errdescr); return (FALSE); } if (!is_uploaded_file($_FILES['rv_source']['tmp_name'])) { $errdescr = "Failed to upload files (right video)."; utils_show_error($errdescr); return (FALSE); } if ((strlen($_FILES['a_source']['tmp_name']) > 0) && !is_uploaded_file($_FILES['a_source']['tmp_name'])) { $errdescr = "Failed to upload files (audio)."; utils_show_error($errdescr); return (FALSE); } /* Check whether destination directory exists */ $mediadir = trim($GLOBALS['media_prefix'].$_POST['title']); if (is_dir($mediadir)) { $errdescr = "Media already uploaded."; utils_show_error($errdescr); return (FALSE); } /* Create media directory */ if (!mkdir($mediadir)) { $errdescr = "Failed to create media directory."; utils_show_error($errdescr); return (FALSE); } /* Upload files */ print "<pre>"; /* Upload and move files to the correct position */ if (!move_uploaded_file($_FILES['lv_source']['tmp_name'], $mediadir."/LVIDEO.mpg")) { $errdescr = "Generic upload error."; utils_show_error($errdescr); wiew_media_delete($_POST['title']); return (FALSE); } if (!move_uploaded_file($_FILES['rv_source']['tmp_name'], $mediadir."/RVIDEO.mpg")) { $errdescr = "Generic upload error."; utils_show_error($errdescr); wiew_media_delete($_POST['title']); return (FALSE); } if (strlen($_FILES['a_source']['tmp_name']) > 0) { if (!move_uploaded_file($_FILES['a_source']['tmp_name'], $mediadir."/AUDIO.wav")) { $errdescr = "Generic upload error."; utils_show_error($errdescr); wiew_media_delete($_POST['title']); return (FALSE); } } print "</pre>"; $errdescr = ""; return (TRUE); }
file_uploads = on
post_max_size = 2048M
upload_max_filesize = 2048M
max_execution_time = 360
max_input_time = 360
memory_limit = 1024M
Now that's the problem... No POST variables are available to the PHP script. My needs are to upload 2/3 files, but because they are MPEG videos, they are very large (@300 MB for each video and @70M for audio).
Thank you is advance... this is very urgent!When using Windows, have you ever told "Ehi... do your business?"
Linux user #396597 (http://counter.li.org)
- 09-16-2005 #2Linux User
- Join Date
- Aug 2005
- Location
- Italy
- Posts
- 401
Solved!
OK, I've worked on it 2/3 days, but now I've found the trick...
post_max_size directive can't be of 2048... its upper limit is 2047!!!!
Now everything works... I've checked also that script memory limit is not important, so I've set it on the default value...When using Windows, have you ever told "Ehi... do your business?"
Linux user #396597 (http://counter.li.org)


Reply With Quote
