0
$name   = $_POST['name'];
$image   =  $_FILES['image'];
$location   = $_POST['location'];
$category   = $_POST['category'];
$username   = $_POST['username'];
//$imageData =addslashes (file_get_contents($_FILES['image']['tmp_name']));
$imageData =addslashes (file_get_contents("http://zbatny.info/HOOT/amsek/prob/5.jpg"));
$image =$_FILES['image']['name']; 
$type=$_FILES['image']['type']; 
$file_tmp=$_FILES['image']['tmp_name'];

if(!is_writable("../../images/"))
echo('You cannot upload to the specified directory, please CHMOD it to 777.');

 if(move_uploaded_file($imageData,"../../images/".$image)) 
 { 

 //Tells you if its all ok 
 echo "The file ". basename( $_FILES['image']['name']). " has been uploaded, and your information has been added to the directory"; 
 } 
 else { 

 //Gives and error if its not 
 echo "Sorry, there was a problem uploading your file."; 
 } 
//$insert = "INSERT INTO problems(Name,Description,Image, Location, Category, Username, Vote, Spam) VALUES ('" . $name . "','sherif sobhy','$image','0','0','" . $username . "','0','0')";

$query  = mysql_query($insert);  
    if ($query) 
    {  
        echo "Thank You";  
    }  
    else  
    {  
        echo "Insertion failed";  
    } 

Inline Code Example Here
i tried many paths but i can't insert so please anyone help me thanks in advanced but here to make sure that my php is right i upload i inserted it in my server and i give it the path

Edited by sherif.sobhy.37

3
Contributors
7
Replies
24
Views
4 Years
Discussion Span
Last Post by Meir David
0

What's this got to do with javascript?

$insert = "INSERT INTO problems(Name,Description,Image, Location, Category, Username, Vote, Spam) VALUES ('$name','sherif sobhy','$image','0','0','$username','0','0')";

Should work.

0

the insertion process works normally but i commented it because now my problem is that i can't upload into my server i don't know why ????

0
$image =$_FILES['image']['name']; 

is wrong if you are going to use it as the source file in move_uploaded_file. use:

$image =$_FILES['image']['tmp_name']; 
0

done but now it show me this error
Warning: move_uploaded_file(/home/amrfahmy/domains/zbatny.info/public_html/images/940_10151528660414606_2076416029_n.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/amrfahmy/domains/zbatny.info/public_html/HOOT/amsek/prob/insert_prob.php on line 29

0

Hi,
When i was doing i too face the same problem.on seeing this thread i just tried and got solved..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.