Jump to content

[SOLVED] Display image on Iframe when reload/refresh with php?


StefanRSA

Recommended Posts

I am working on an image upload form and am using straight php to do the upload.

It works without a submit button button to do the actual submitting but

<input size="10" type="file" name="img1" onchange="image.submit();" >

and the form submit to itself

 

This form is embedded in another form.

When I select a file in the iframe - Form, the upload starts but nothing else happen.

When the file is uploaded the iframe reloads itself, flash white before it goes tranparent and continue with the code....

 

How can I

 

[*]Display an image with file upload

[*]Stop the ugly with flash

 

Any suggestions please!

Can you re-phrase this?

I think you are uploading a form to a php script. The form is in an iframe.

 

Not sure what you are asking after that.

 

How can I 

Display an image with file upload
Stop the ugly with flash

..none of which makes sense.

 

Do you mean:

 

How can I display the image that has just been uploaded?

How can I prevent the iframe reloading and showing a white screen for a second or so?

 

Can't imagine there should be a big issue with a white screen, unless it is taking ages to download and display the new image.

 

 

Possible solutions:

 

(1) Depending on the name of the form etc. "image.submit()" may be the problem with why it won't auto-submit.

 

(2) If you must use an iframe, how about submitting the file upload via Ajax, displaying a "Please Wait" whilst it is processing, then display the image when completed (in your iframe). This will resolve any white screen issues and displaying of the image.

 

The image is already displayed after upload fine...

I want an animated image to display while the image uploads....

 

Mr Marcus, This is a members form and in the members form is an Iframe. Thie iFrame src points to an image upload form (The one you helped me with yesterday). The total images that can be uploaded changes depending on the category a user has chosen... but by default 4 images... So... When a member select a file to upload, I want to display a "animated loading" gif while the file uploads until the complettion of upload, where the upload form refresh to display the uploaded image....

My My.... To those thinking that this cannot be done....

The answer is simple!

 

In your head section paste the following:

<script language="javascript" type="text/javascript">
<!--
function showProgress() {
document.getElementById("progress").style.visibility = 'visible';
}
//-->
</script>

 

And use the function on OnClick or Onselect depending on the need like follow:

<input size="10" type="file" name="img1" onchange="image.submit(); javascript:showProgress();" onclick="">

 

And ad the image in a <span> where needed.... like:

 

<span id="progress" style="visibility:hidden"><img src="../images/ajax-loader.gif"/></span>

My My.... To those thinking that this cannot be done....

The answer is simple!

 

Nobody said it can't be done.

 

The problem is nobody understood what you were on about.

 

Your English is very poor (in the first post anyway).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.