-1

I need a way to check if an image has been uploaded. I want to do this by checking if a certain URL is existing.

I am getting clients to upload files to my site for their account and I want a tick to appear next to the upload box to show that the file exists.

The uploaded file URLs will be something along the lines of: http://www.example.com/Practitioner-Area/($user.firstname$)+NI

The tick file will be: http://www.example.com/Practitioner-Area/images/complete.jpg

I think I will need a jquery but I have never used them before. So I would prefer a standard html code tbh, but will use jquery if needed.

Any help would be much appreciated.

Matt

Mehdi Karamosly
  • 5,388
  • 2
  • 32
  • 50
  • Have you tried searching for tutorials on how to upload images? http://www.matlus.com/html5-file-upload-with-progress/ – cimmanon Jun 18 '13 at 19:32
  • your tick file is not accessible you probably need to place it into a public accessible folder (you probably need to fix your htdocs) – Mehdi Karamosly Jun 18 '13 at 19:36
  • Maybe this can help you; [http://stackoverflow.com/questions/10926880/using-javascript-to-detect-whether-the-url-exists-before-display-in-iframe][1] [1]: http://stackoverflow.com/questions/10926880/using-javascript-to-detect-whether-the-url-exists-before-display-in-iframe – boffman Jun 18 '13 at 19:39
  • A well-written uploader shouldn't need to access the file and make sure it exists. You ought to be able to bind the "tick" showing event to the success of it uploading. – Adam Grant Jun 18 '13 at 19:43

1 Answers1

0

Try the onerror event:

<img src="image.gif" onerror="alert('The image could not be loaded.')">

Then try to load that outside of screen or something.

Edit: This will create errors on the page so the AJAX result answer is the better one.

Jonathan
  • 8,771
  • 4
  • 41
  • 78