Click to See Complete Forum and Search --> : warn on image upload
72newbie
06-15-2008, 12:07 AM
Hi, I've looked and can't figure out how to warn on an image being uploaded. I can place a javascript alert, but I'm looking for something a little cleaner than that.
I have found a lot of scripts that show a loading bar and the amount of time it will take, but I'd be happy to just have an image or text appear on the screen that says "uploading, please wait" and disappears when complete...is this possible without ajax?
ayvegh
06-15-2008, 08:46 AM
Unless you have the "php_uploadprogress" plugin installed, the answer is quite simply: No, not with out AJAX.
As far as warning on an image being uploaded, I would suggest checking the mime type and/or original filename's extension once it has been uploaded - then you can simply have your script reject it (although I don't think that's really what you had in mind ;))
Hope this helps,
ayvegh
72newbie
06-15-2008, 09:16 AM
Is what I was thinking was something like this:
$alert="echo '<div ><h1>Uploading..</h1></div>'";
$display_output .= '<tr> '.
'<td align="right" nowrap><br>Upload Image</td> '.
'<td><br><input type="file" name="item_file_upload_' . $media_type . '" style="width: 250px;" onChange="'.$alert.'"/><br></td> '.
'<td ' . (($this->upload_url) ? 'rowspan="2"' : '') . ' width=""></td> '.
'</tr> ';
That does nothing...surely there is a way to do this...
but I'm getting a t_string error....
ayvegh
06-16-2008, 12:34 PM
I don't understand exactly what you're trying to do - from the looks of it, I would say you're trying to do JavaScript with PHP.
With AJAX, yes, you can upload a file, say "Please wait, uploading...", then hide it after.