ayok Posted December 22, 2007 Share Posted December 22, 2007 Hi, I have a problem working with register global = Off. I used to set it "on" when I worked on my scripts in my local server. However, i heard that it's not recommended. So now I add some $_GET, $_POST, etc. Mostly I can do, but now I have a problem with uploading script. Especially, on admin pages. I upload the image with a simple script: <?php include "../../connection/db.php"; echo "<FORM enctype=MULTIPART/FORM-DATA METHOD=POST ACTION=input_pic.php>"; echo "Upload picture:<input type=file name=[u]fupload[/u]> "; echo "<INPUT TYPE=SUBMIT VALUE=add>"; }?> With register global = On, I can just write the input_pic.php like this: <?php include "../../connection/db.php"; $input=mysql_query("INSERT INTO gallery(image) VALUES('$fupload_name')") or die(mysql_error()); $direktori_file = "../../gallery/images/original/$fupload_name"; if ($fupload_type != "image/pjpeg" AND $fupload_type != "image/jpeg") { echo "Type file <b>$fupload_name</b> is $fupload_type<br>"; echo "Insert image is failed<br>"; } elseif (!move_uploaded_file($fupload, "$direktori_file")) { echo "Upload process failed!<br>"; echo "<a href=add_pic.php>Upload again</a><br>"; } The name fupload can be $fupload, $fupload_name, or $fupload_type. However, with register global = off, the script doesn't work. I've tried to insert $fupload=$_GET[fupload] , but it doesn't work either. Could anybody help me out here? Thank you, ayok Link to comment https://forums.phpfreaks.com/topic/82831-solved-register-global-problem-image-upload/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 22, 2007 Share Posted December 22, 2007 Read example 2 at this link to find out how you should be accessing uploaded file data - http://www.php.net/manual/en/features.file-upload.php Link to comment https://forums.phpfreaks.com/topic/82831-solved-register-global-problem-image-upload/#findComment-421258 Share on other sites More sharing options...
ayok Posted December 22, 2007 Author Share Posted December 22, 2007 Hi thanks! That really helps. ayok Link to comment https://forums.phpfreaks.com/topic/82831-solved-register-global-problem-image-upload/#findComment-421293 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.