dream25 Posted June 5, 2007 Share Posted June 5, 2007 Hi All... Im newbie to PHP.. actually i wrote a code for upload... when i run that code its shows... Warning: move_uploaded_file(../xampp/htdocs/general/test.php) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\xampp\htdocs\upload.php on line 9 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\xampp\tmp\php65.tmp' to '../xampp/htdocs/general/test.php' in C:\xampp\htdocs\upload.php on line 9File uploaded. Select File: that saving path has been rite... but i dont know y its shows this error.. Please Help Me.. Here i attached the coding... <?php if ($_POST[submitB] == "Upload File") { echo exec('whoami'); move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'], "../xampp/htdocs/general/{$_FILES['uploadFile'] ['name']}"); echo "File uploaded."; }?> <html> <body> <form enctype="multipart/form-data" action="upload.php" method="post"> Select File: <input type="file" name="uploadFile"> <input name="SubmitB" type="submit" value="Upload File"> </form> </body> </html> Thanks In Advance.. Quote Link to comment https://forums.phpfreaks.com/topic/54234-prob-in-upload/ Share on other sites More sharing options...
Lumio Posted June 5, 2007 Share Posted June 5, 2007 Try another directory... replace the move_uploaded_file function with that code: if (move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],"./general/{$_FILES['uploadFile'] ['name']}")) { echo 'File uploaded'; } Quote Link to comment https://forums.phpfreaks.com/topic/54234-prob-in-upload/#findComment-268150 Share on other sites More sharing options...
dream25 Posted June 5, 2007 Author Share Posted June 5, 2007 Thank u very much.. its working now... bye Quote Link to comment https://forums.phpfreaks.com/topic/54234-prob-in-upload/#findComment-268158 Share on other sites More sharing options...
dream25 Posted June 5, 2007 Author Share Posted June 5, 2007 Hi.. i have one more doubt.. please clear it.. i wrote a code for search engine.. if i run that code.. its shows.. nothing.. the code has follows.. <html> <body> Search: <form method='post' action='search.php'> <input type='text' name='search' size='25' maxlength='25'> <input type='Submit' name=' Search ' value='Submit'> </form> </body> </html> <?php $host="localhost"; $username="root"; $password=""; $db_name="database1"; $tbl_name="table1"; if(isset($_POST['submit'])) { echo "Your Name Is <br>" . $_POST['search'] ; mysql_connect("$localhost", "$username", "$password")or die("Cannot connect"); mysql_select_db("$db_name")or die("Cannot select database"); $search=$_POST["search"]; $result = mysql_query("SELECT * FROM '$tbl_name' WHERE name LIKE '%$search%'"); while($r=@mysql_fetch_array($result)) { //change the names to your columns $topic=$r["topic"]; $message=$r["message"]; $name=$r["name"]; $date=$r["date"]; $id=$r["id"]; //display the row echo "<b>$id</b> | <b>$topic</b> by <b>$name</b> at <b>$date</b><br><br>$message"; } if(!search){ echo "Please enter a search."; } else { echo "Sorry, there were no searches with the criteria of <b>$search</b>."; } } ?> Thanks In Advance Quote Link to comment https://forums.phpfreaks.com/topic/54234-prob-in-upload/#findComment-268166 Share on other sites More sharing options...
Lumio Posted June 5, 2007 Share Posted June 5, 2007 Create a new topic and please use code-tags ([.code] and [./code] [without the dot]) Quote Link to comment https://forums.phpfreaks.com/topic/54234-prob-in-upload/#findComment-268199 Share on other sites More sharing options...
dream25 Posted June 5, 2007 Author Share Posted June 5, 2007 Hi.. in my coding only small files only loading.. if i load exe.. and big size files and etc.. are not loading.. y its not uploading.. please help me.. Thanks in Advance Quote Link to comment https://forums.phpfreaks.com/topic/54234-prob-in-upload/#findComment-268260 Share on other sites More sharing options...
Lumio Posted June 5, 2007 Share Posted June 5, 2007 that's because of apache... you can set it to a maximum and most time the maximum is 8MB. Quote Link to comment https://forums.phpfreaks.com/topic/54234-prob-in-upload/#findComment-268299 Share on other sites More sharing options...
dream25 Posted June 5, 2007 Author Share Posted June 5, 2007 Thanks .. but how will i set..please guide me Quote Link to comment https://forums.phpfreaks.com/topic/54234-prob-in-upload/#findComment-268335 Share on other sites More sharing options...
Lumio Posted June 5, 2007 Share Posted June 5, 2007 Are you the owner of the whole server? If not, you can't change it. Quote Link to comment https://forums.phpfreaks.com/topic/54234-prob-in-upload/#findComment-268336 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.