Dathremar Posted February 14, 2008 Share Posted February 14, 2008 After searching the web and not finding anything like this I decided to post my problem here, I hope some1 can help... I made an upload page with 2 input fields. It works perfectly on local machine and on test server, BUT it does not work on the live server. I used echo $myfile and echo $myfile1 (names of the input fields) to get the value of the variable after the submit and on the local server and test server I get empty variable (ofc when i leave the fileds empty) and when I leave the fields empty and submit the form on the live server I get the value Array in both of the variables......... I really don't know why is this happening.. Is it something about versions of php, OS or something like that .... Everything i read so far says that input type=field CAN'T have default value ...... Maybe it is a newb question, but if some1 knows any info about this plz answer Quote Link to comment Share on other sites More sharing options...
trq Posted February 14, 2008 Share Posted February 14, 2008 Helps if you post the relevent code. Quote Link to comment Share on other sites More sharing options...
Dathremar Posted February 15, 2008 Author Share Posted February 15, 2008 Ok here is the definition of the input boxes: <input name="myfile" type="file" class="text11_crn_bold" id="myfile" size=20> <input name="myfile1" type="file" class="text11_crn_bold" id="myfile1" size=20> And i am doing a checking if they are empty or not after submitting: if (trim($myfile) == "") { if (trim($myfile1) == "") { do something if both empty } else $error_msg = ERR_logo; } else { if ($myfile1 == "") $error_msg = ERR_logo; else { do something else if both full } } } So the thing is that it is always considering that the variables $mfile and $myfile1 are full and goes to the part to do something if both full no matter if i leave the input boxes empty or not. I used echo to view the value of the variable and it displayed Array on the on line server and like I said on my local server and test server it is working fine. If you have more q about this tell me. Thx for trying to help. Quote Link to comment Share on other sites More sharing options...
Stooney Posted February 15, 2008 Share Posted February 15, 2008 Your test server probably has register globals on where the live server doesn't. Try using $_POST['myfile'] instead of just $myfile. Quote Link to comment Share on other sites More sharing options...
Dathremar Posted February 15, 2008 Author Share Posted February 15, 2008 Thx m8 I don't know how could I be so stupid, solution is so simple: $_FILES['myfile']['name'] -> variable that is send by the input type=file You gave me a push in the right direction. Thanks for help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.