daled Posted April 13, 2007 Share Posted April 13, 2007 This has me clueless: form: <form action="process.php?action=upload<?php echo $_GET['info']; ?>" method="POST" enctype="multipart/form-data"> <input type="file" name="music1" size=30 class="field2" /> <input type="submit" value="Upload" class="submit" /> </form> code: if(isset( $_FILES['music1']['name'] ) and ( $_FILES['music1']['name'] != '' )){ copy( $_FILES['music1']['tmp_name'], 'C:/Program Files/Apache Group/Apache2/htdocs/Record Label/Second Layout/Files/'.$_FILES['music1']['name'] ) or die("Could not upload Song 1"); }; The troubling thing is that the code works with pictures and application files. I think that the form isn't creating a ['tmp_name'] for the file because it does for pictures etc. any help would be nice. thanks. Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted April 13, 2007 Share Posted April 13, 2007 try it - just use a regular dump of the results and see what gives. it may also be worth checking the size of the actual file to make sure your limits are big enough to accept it. <?php if ($_FILES) { echo '<pre>'; print_r($_FILES); echo '</pre>'; } ?> i'm not actually sure it's relevent to your problem, but move_uploaded_file is generally more commonly used for file uploads Quote Link to comment Share on other sites More sharing options...
daled Posted April 14, 2007 Author Share Posted April 14, 2007 i tried the move_uploaded_file and that didn't work. i change the max upload file size to 10000000M or something in the php.ini file. i'll try your suggestion when i get home. Quote Link to comment Share on other sites More sharing options...
daled Posted April 14, 2007 Author Share Posted April 14, 2007 here's what i got: [music1] => Array ( [name] => Dark Blue.mp3 [type] => [tmp_name] => [error] => 1 => 0 ) When i put in a jpg (into another upload on the same page): [thumbnail] => Array ( [name] => 100_0838.JPG [type] => image/jpeg [tmp_name] => C:\PHP\uploadtemp\phpA57.tmp [error] => 0 => 607604 ) interpretations? Quote Link to comment Share on other sites More sharing options...
HeyRay2 Posted April 14, 2007 Share Posted April 14, 2007 The error array element being set to "1" leads me to believe there was an error reading the file. Have you tried other mp3 files? Perhaps try a very small mp3 (sound byte under 500k would be a good test) to see if your PHP configuration limit for max_post_size is too low (the setting for all parts of a form submission).' Quote Link to comment Share on other sites More sharing options...
daled Posted April 14, 2007 Author Share Posted April 14, 2007 i successfully uploaded one 577K, but a larger one didn't work. i changed post_max_size in the php.ini to 100000000M or something and that didn't work. the upload_max_filesize is still very large Quote Link to comment Share on other sites More sharing options...
daled Posted April 14, 2007 Author Share Posted April 14, 2007 bump. Quote Link to comment Share on other sites More sharing options...
daled Posted April 15, 2007 Author Share Posted April 15, 2007 bump... Quote Link to comment Share on other sites More sharing options...
daled Posted April 15, 2007 Author Share Posted April 15, 2007 now i have another problem, maybe they're linked. i'm trying to put a 4 mb limit on picture uploads, but when i try to upload a large file, it still executes the sql code to insert a new row, but doesn't upload the file: form: <b>Max Size:</b> 4mB<br> <b>Allowed Formats:</b> .jpg .gif .png<br /> Be aware that .png does not view correctly on Internet Explorer 6.<br /><br /> <form action="manage.php?action=upload&info=pictures" method="post" enctype="multipart/form-data"> <input type="file" name="picture1" size=45 class="field2" /> <br /> <input type="file" name="picture2" size=45 class="field2" /> <br /> <input type="file" name="picture3" size=45 class="field2" /> <br /> <input type="file" name="picture4" size=45 class="field2" /> <br /> <input type="file" name="picture5" size=45 class="field2" /> <br /> <center> <br /> <span class="h3"> <BR /> <input type="submit" value="Upload" class="submit" /> <input type="hidden" value="upload" name="upload" /> </span> </center> </form> php code (this is the same for all the form): <?php if(isset( $_POST['upload'] ) and ( $_POST['upload'] == "upload" )){ if(isset( $_FILES['picture1']['name'] ) and ($_FILES['picture1']['name'] != "" )){ if(( $_FILES['picture1']['size'] < 4194304 ) and ( $_FILES['picture1']['type'] == "image/png" or "image/jpeg" or "image/gif" or "image/pjpeg" or "image/x-png" or "image/gif")){ //upload move_uploaded_file( $_FILES['picture1']['tmp_name'], "C:/Program Files/Apache Group/Apache2/htdocs/Record Label/Second Layout/Files/".$_FILES['picture1']['name'] ); //sql query $database = $_COOKIE['number']; $conn = mysql_pconnect('localhost', 'root', ''); mysql_select_db($database, $conn); $query_journal = sprintf("INSERT INTO `pictures` (url) VALUES ('%s')", "Files/".$_FILES['picture1']['name']); $journal = mysql_query($query_journal, $conn) or die(mysql_error()); $pic1 = 'Picture 1 has been uploaded successfully<br>'; $pic15 = $_FILES['picture1']['size']; $pic155 = $_FILES['picture1']['type']; }else{ $pic1 = "Picture 1 too large"; }; }; }; ?> now i'm totally baffled! Quote Link to comment Share on other sites More sharing options...
marcus Posted April 15, 2007 Share Posted April 15, 2007 Try changing your max_execution_time in your php.ini. Quote Link to comment Share on other sites More sharing options...
daled Posted April 16, 2007 Author Share Posted April 16, 2007 upped max execution time from 30 to 3600. still no good: with an mp3 [music1] => Array ( [name] => To Youth.mp3 [type] => [tmp_name] => [error] => 1 => 0 ) with a jpg [music1] => Array ( [name] => pieceFINAL.jpg [type] => [tmp_name] => [error] => 1 => 0 ) Quote Link to comment Share on other sites More sharing options...
daled Posted April 17, 2007 Author Share Posted April 17, 2007 bump. Quote Link to comment Share on other sites More sharing options...
daled Posted April 17, 2007 Author Share Posted April 17, 2007 more bumping. Quote Link to comment Share on other sites More sharing options...
daled Posted April 18, 2007 Author Share Posted April 18, 2007 bump Quote Link to comment Share on other sites More sharing options...
daled Posted April 18, 2007 Author Share Posted April 18, 2007 come on. i really need this help. i'm completely clueless. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.