-3

localhost ta code works regularl.I threw my filezilla files.While adding an image, url prints the image name to the database, but does not drop the folder image.why could it be

    $uploads_dir='images/homepage_balcony/front_face/';
    @$tmp_name =$_FILES['image']["tmp_name"];
    @$name =$_FILES['image']["name"];
    $benzersizsayi1=rand(20000,32000); 
    $benzersizsayi2=rand(20000,32000); 
    $benzersizsayi3=rand(20000,32000); 
    $benzersizsayi4=rand(20000,32000);                
$benzersizad=$benzersizsayi1.$benzersizsayi2.$benzersizsayi3.$benzersizsayi4;
    $image=substr($uploads_dir, 6).$benzersizad.$name;
    @move_uploaded_file($tmp_name, "$uploads_dir/$benzersizad$name"); 
Aman Deep
  • 381
  • 4
  • 16
  • 1
    can you show the code you use ? – ᴄʀᴏᴢᴇᴛ Jul 02 '18 at 12:10
  • $uploads_dir='images/homepage_balcony/front_face/'; @$tmp_name =$_FILES['image']["tmp_name"]; @$name =$_FILES['image']["name"]; $benzersizsayi1=rand(20000,32000); $benzersizsayi2=rand(20000,32000); $benzersizsayi3=rand(20000,32000); $benzersizsayi4=rand(20000,32000); $benzersizad=$benzersizsayi1.$benzersizsayi2.$benzersizsayi3.$benzersizsayi4; $image=substr($uploads_dir, 6).$benzersizad.$name; @move_uploaded_file($tmp_name, "$uploads_dir/$benzersizad$name"); – Ugur Gürsel Jul 02 '18 at 12:12
  • please edit your post and paste your code into your question to have it properly formatted. it is unreadable in comments – ᴄʀᴏᴢᴇᴛ Jul 02 '18 at 12:13
  • I made corrections – Ugur Gürsel Jul 02 '18 at 12:21
  • it is a very bad practice to use `@` to silent errors. try by removing them to see if there are errors. Then you should check for upload errors (into `$_FILE['image']['error']`) before processing the file – ᴄʀᴏᴢᴇᴛ Jul 02 '18 at 12:32
  • working on localhost . does not work after uploading to filezilla . why could it be – Ugur Gürsel Jul 02 '18 at 12:37
  • the code works but – Ugur Gürsel Jul 02 '18 at 12:37
  • it can be a difference in the configuration of php so you have to do what I said to see what the error is, otherwise you have to guess where the error happens... – ᴄʀᴏᴢᴇᴛ Jul 02 '18 at 12:39

1 Answers1

0

Please check your folder permissions of 'images/homepage_balcony/front_face/'. All the folders should have writable permissions.