Jump to content

Prob in upload


dream25

Recommended Posts

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..

Link to comment
Share on other sites

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';
}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.