sharpmac Posted June 19, 2009 Share Posted June 19, 2009 $dir = $_REQUEST["imageDir"]; move_uploaded_file($_FILES['Filedata']['tmp_name'], $dir.="/".$_FILES['Filedata']['name']); Doesn't work $dir = "test"; move_uploaded_file($_FILES['Filedata']['tmp_name'], $dir.="/".$_FILES['Filedata']['name']); WORKS..... WHAT IS GOING ON? I mostly am bashing my head into a wall because it works with a static variable, but not one that is pulled in from ANYWHERE! I tried _GET, _POST, _REQUEST I even tried saving the variable in a xml file, and getting it to read it from the node. This has to be my own frustration making me over look the simplicity of my error. I am grateful for any feedback. Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/ Share on other sites More sharing options...
xtopolis Posted June 19, 2009 Share Posted June 19, 2009 I wouldn't concatenate inside the function, personally. Also, stick with _GET or _POST as _REQUEST is depreciated. $dir = $_GET['imageDir']; move_uploaded_file($_FILES['Filedata']['tmp_name'], $dir . "/" . $_FILES['Filedata']['name']); Maybe that changes something? (no .=) Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-859358 Share on other sites More sharing options...
sharpmac Posted June 19, 2009 Author Share Posted June 19, 2009 Thank you for the reply. Switched out the 2 lines and tested it out. No luck, as well as the variable no longer has the "/" at the end. the .= seems to be needed in this event. I really have no idea. Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-859369 Share on other sites More sharing options...
xtopolis Posted June 19, 2009 Share Posted June 19, 2009 move_uploaded_file $filename = $_FILES['Filedata']['tmp_name']; $destination = $_GET['imageDir'] . '/' . $_FILES['Filedata']['name']; move_uploaded_file($filename, $destination); Try that, the issue may have been me using "/" instead of '/'. Check to make sure your input variables ($_GET['imageDir'], and $_FILES['Filedata']['name']) are working as expected if that doesn't work. Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-859374 Share on other sites More sharing options...
Jibberish Posted June 19, 2009 Share Posted June 19, 2009 as _REQUEST is depreciated. It is? Is there any documentation on this as I can't find any. Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-859443 Share on other sites More sharing options...
xtopolis Posted June 19, 2009 Share Posted June 19, 2009 I couldn't find my source for this after a few mins of googling.. However, when you have $_POST and $_GET, you should more often than not know what to expect rather than be "flexible" with it. Perhaps someone else can chime in on this, but I'm fairly certain it is bad practice to use $_REQUEST in general. Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-859512 Share on other sites More sharing options...
sharpmac Posted June 19, 2009 Author Share Posted June 19, 2009 I tested out the new code, the form is pulling it down properly and it is adding the / at the end of the variable. But it is simply refusing to place the images in that freaking directory. I have attached the zip file, there are four main files being used. adm_gallery.php processes he form, gets the data and makes the directory as well as edits various files used in the gallery script. upload.php this is where the flash file calls to in order to take the temp files and move them to the specified directory settings.xml this file holds the variables that flash uses to pull from, it's only real function is style and to point to the "upload.php" file. Uploader.as AS3 code compiling the flash application and naming variables used throughout. Run index.html I filled in the requirements already so just hit submit, the script will make 1 folder and 1 file. Folder "test" and file 9999999.xml. The xml file the script makes is only for the gallery viewer it is not needed to make the uploaded function. Anyways I am sure all of you are more then able to figure out how the rest of it works... if you have any suggestions i would love to hear them. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-859697 Share on other sites More sharing options...
chmpdog Posted June 19, 2009 Share Posted June 19, 2009 yah, $request is defabricated. I was looking at it last night. Try echoing the $_get Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-859708 Share on other sites More sharing options...
sharpmac Posted June 19, 2009 Author Share Posted June 19, 2009 I have tried the script many times _GET does not echo, but _POST does. I am wondering if this is a glitch or something within php..... it does not make any since to that it will pass a static variable vs a _GET or _POST Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-859812 Share on other sites More sharing options...
J.Daniels Posted June 19, 2009 Share Posted June 19, 2009 I tested out the new code, the form is pulling it down properly and it is adding the / at the end of the variable. But it is simply refusing to place the images in that freaking directory. If the path is correct, check the permission on the directory. The server needs to be able to write to it either by owning the directory or CHMOD needs to be set to 777 Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-859831 Share on other sites More sharing options...
chmpdog Posted June 19, 2009 Share Posted June 19, 2009 I suggest you review your understanding of $_GET AND $_POST tags. get tags are used in the url, while post tags are from a form. http://www.tizag.com/phpT/postget.php Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-859858 Share on other sites More sharing options...
sharpmac Posted June 20, 2009 Author Share Posted June 20, 2009 If the path is correct, check the permission on the directory. The server needs to be able to write to it either by owning the directory or CHMOD needs to be set to 777 CHMOD is not the issue, it is running off of local host of my windows xp desktop. Even if it was CHMOD, why would $dir = "test"; WORK and $dir = $_GET['imageDir']; NOT? Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-860345 Share on other sites More sharing options...
sharpmac Posted June 20, 2009 Author Share Posted June 20, 2009 I suggest you review your understanding of $_GET AND $_POST tags. get tags are used in the url, while post tags are from a form. http://www.tizag.com/phpT/postget.php I have tried the code many ways, re-written the form to process via get and post. Weather its in the URL, or posted in the session it doesn't matter. It simply will not use $dir unless it is a STATIC variable. And I'm lost as to why. Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-860348 Share on other sites More sharing options...
mattal999 Posted June 20, 2009 Share Posted June 20, 2009 Well, the fact that the uploading tool is a flash file makes it hard for us to help. Can I see the actionscript for the upload button on the flash file? EDIT: Never mind. I'll look through the AS. Ok. The directory is being created in my case and no file is being created, but I can't see how you are even requesting the directory name variable. I'm kind of lost in this case. Sorry. Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-860351 Share on other sites More sharing options...
chmpdog Posted June 21, 2009 Share Posted June 21, 2009 what is the output when you echo it? and what variable did you put in. Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-860748 Share on other sites More sharing options...
sharpmac Posted June 22, 2009 Author Share Posted June 22, 2009 In the form for _POST, I also try to pass in the variable "test". Once I submit the form the echo does read "test/", it echo's correctly when it is static variable or not. The only difference is when the variable is coming from the form it does nothing with the uploaded files. I can't find them in the anywhere, not even the localhost tmp directory. I know the flash file is complex, and for the most part it doesn't need to be changed, because I have passed variable to flash via, _GET & _POST before, and it works when the variable is static. Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-861199 Share on other sites More sharing options...
gevans Posted June 22, 2009 Share Posted June 22, 2009 Just a note on request variables. http://us3.php.net/manual/en/reserved.variables.request.php _REQUEST is not deprecated. It is an associative array containing the contents of $_GET, $_POST and $_COOKIE. If, as is the usual case, you know where your request is coming from you're better off sticking to $_GET or $_POST, depending on your request type. Sometimes you may find your system will send data using $_GET or $_POST under different situations, at this point you may find you have to use $_REQUEST. Realistically you sould be able to design your system in a way that one set of data is sent using one request type, and you should then stick to it. Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-861205 Share on other sites More sharing options...
chmpdog Posted June 24, 2009 Share Posted June 24, 2009 Just a note on request variables. http://us3.php.net/manual/en/reserved.variables.request.php _REQUEST is not deprecated. It is an associative array containing the contents of $_GET, $_POST and $_COOKIE. If, as is the usual case, you know where your request is coming from you're better off sticking to $_GET or $_POST, depending on your request type. Sometimes you may find your system will send data using $_GET or $_POST under different situations, at this point you may find you have to use $_REQUEST. Realistically you sould be able to design your system in a way that one set of data is sent using one request type, and you should then stick to it. thanks for this... Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-862819 Share on other sites More sharing options...
aggrav8d Posted June 24, 2009 Share Posted June 24, 2009 $dir = $_REQUEST["imageDir"]; $dir.="/".$_FILES['Filedata']['name']; echo $dir; // The only way to be sure. move_uploaded_file($_FILES['Filedata']['tmp_name'], $dir); Link to comment https://forums.phpfreaks.com/topic/162860-wtf-i-feel-like-everything-in-my-life-hinges-on-this-simple-concept/#findComment-862825 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.