I am using Iframe to upload images without refresh with the following function
Code:
function ajaxFileUpload(upload_field)
{
// Checking file type
var re_text = /\.jpg|\.gif|\.jpeg/i;
var filename = upload_field.value;
if (filename.search(re_text) == -1) {
alert("File should be either jpg or gif or jpeg");
upload_field.form.reset();
return false;
}
document.getElementById('picture_preview').innerHTML = '<div><img src="../images/loader_light_blue.gif" border="0" /></div>';
upload_field.form.action = 'ajaxupload.php';
upload_field.form.target = 'upload_iframe';
upload_field.form.submit();
upload_field.form.action = '';
upload_field.form.target = '';
return true;
}
I am new to JS, so please bare with me....
I can, after upload create a link that has the name of the image and want to use this link to delete the image without refresh like:
What function should I write and how, to get the value of image sent to the deleteimage.php ????
I know I should also update the iframe and will struggle with that... Please just give me a clue on how to send the value of image to my deleteimage.php page
Yes, that is the php script that will be used in the deleteimage.php file.
What javascript function should I call to send this value to the deleteimage.php...
function ajaxFileUpload(upload_field){} send the uploaded data to my upload.php from the index.php and then updates the iframe as well after image upload. This happen onchange of the upload field ie.:
No it will not delete without a refresh of the iframe, but it will delete without a refresh of the page the iframe is embedded in. Seeing how you are using an iframe and submitting a form in it anyway, I figured this is what you wanted.
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
awesome.
Ok, no sorry. I need to refresh the Iframe again to get the upload field back again. This is to make sure someone can upload an image and delete if not happy and re-upload.... Do you want me to put both my files here so you can see what I am trying to do?
Bookmarks