Results 1 to 8 of 8
Jun 1, 2007, 18:00 #1
Script works on one domain but not another
So I have a simple file uploader which allows the user to select the category for an image, then uploads the file and puts the image category into a mySQL database. Now when I developed this script for my client it worked fine on my webspace, but when I uploaded it to her site it stopped working.
The script asks for a file location and the category, and passes the file array and category array through post. Here's the basic form:
<input name="userfile" type="file" size="40" /> Category: <select name="category"> <option value="1">cat 1</option> <option value="2">cat 2</option> </select> ...(there can be n forms, and the next one is identical:) <input name="userfile" type="file" size="40" /> Category: <select name="category"> <option value="1">cat 1</option> <option value="2">cat 2</option> </select>
And on submit it posts the arrays back to the same page (index). Now, on my site this works fine and it recieves the category array. If I do print_r($category) on MY webspace it shows that it is in fact recieiving the array. But on HER page print_r($category) returns nothing, and I've done other checks: it's not getting passed. The scripts are identical. It's passing the array of files on both sites fine, but not the category array?! Could it be different permissions..different php versions? This is really strange...
Jun 1, 2007, 18:15 #2
if ur uploading files, check the folder permissions for the destination, or it could be a another setting. most likely folder permission.
Jun 1, 2007, 18:19 #3
Permissions are the same. And as I said, the file array is posted fine, but the category array isn't on her domain.
Jun 1, 2007, 18:22 #4
are you trying to derive the form variables with $category?
If so that sounds like a register_global issue. if you don't know - try print_r($_POST);
Sorry if i'm off track
oh and also just because you can pull $_FILE info doesn't mean the image is uploaded to the real folder, its still sitting in a tmp dir waiting for you to move it.
Jun 1, 2007, 18:31 #5
Ok, looks like we're close, the working site's post looks like
Array (  => x  => x )
While her site (broken) looks like:
Array ( [MAX_FILE_SIZE] => 20000000 [category] => Array (  => x  => x )
But I'm unsure as to how that relates to the passing of arrays
Jun 1, 2007, 18:33 #6
array(array()) means 2 dimensional, because $_POST is an array, and ur categories are sent as an array.
It looks like everything is getting passed.
Now if you want the file info, you would do print_r($_FILES) // maybe without S i forget
Jun 1, 2007, 18:39 #7
Ok, then how do I extract the categories array from the post data? $_POST is returning nothing as well
YOU SHUT UP
I think I got it.
Edit 2 Yeah got it.
Edit 3 rats too slow. But thank you immensely for your help. It's odd that they post data is different for two different sites.
Jun 1, 2007, 18:42 #8
it would be $_POST['categories'] and so on.