Click to See Complete Forum and Search --> : copy upload field


kanuski
09-18-2003, 11:30 AM
I have a php site in which I allow users to upload pictures from their computers. I use javascript to copy the filename of the uploaded file as a new variable. On the next page I use this path and filename to display the picture from their computer. I am getting reports from users that this is not working on some Mac OSX machines. The complete adddress does not seem to be copying. eg. /Israel Summer ''''03/disk1/Acadiabeach.JPG
Is there something I can do to make this more universal?
Here is the code I use:
<form enctype="multipart/form-data" name="join" method="post" action="add2.php" onSubmit="return submitForm(this.submitbutton)">
<center>
<input name="uploadedfile" type="file" onChange="this.form.path.value=this.value;">
<input type=hidden name=path size=15 value="" onChange="this.value=this.form.name.value;">
<input type="submit" name="submitbutton" value='Next Page'>

</center>
</form>

pyro
09-18-2003, 12:14 PM
How about use PHP to display the image they uploaded from your server, rather than trying to pull the image off of their computer?

CyCo
09-18-2003, 12:15 PM
...yes, I ran into this before...
since different platforms/browsers implement different file names/paths or delimiters, you can add a separate text field for the user to add the name for the file...then use that name to compare the actual uploadedfile name.

kanuski
09-18-2003, 12:47 PM
Hi Pyro,
Thank-you for your reply. I did not want to show the image from our server for two reasons:
1. It is faster to load the page from their computer. It may take a few minutes to upload an image and a few more to download it again.
2. I do not want to give anyone the address of this folder. If they know the address they could use this as server space for images on their websites.