how do i use selenium to test javascript image upload? - php

I am using jquery MultiFile js to do an image upload function in an admin page.
I am implementing Selenium right now within phpunit.
I would like a detailed description of how to test the following scenario using Selenium:
1) access to /admin/products/new
2) fill in title textbox
3) click on upload image button
4) upload 2 images
5) hit overall submit button
6) redirect to /admin/products and check for success message
I am able to write assertElementPresent etc commands for steps 1-6 except 3 and 4.
Please advise.

If I understand correctly, you're asking how to upload an image using Selenium. The default way of uploading images would be to use the typeKeys() method to pass the file name to the input file uploader.
Use Selenium to log in as an admin and browse to the /admin/products/new page.
If you're using RC, use typeKeys() to fill in the title textbox. If you're using WebDriver, use keys().
Upload an image by targeting it and sending the file name with typeKeys() or keys().
Refer to step 3.
Use Selenium to click the submit button.
waitForElementPresent on success message.

Related

image upload with Ajax and without Submit button in Codeigniter

I'm using Codeigniter. I need to upload Avatar image for my site. I need to upload image with Ajax and Jquery. But NO need Submit button. When I click upload->open it's directly goes to upload via ajax/jquery.
Here after only im going to start my code. If you want sample code, use this link.
Note: (looks & functions) It's should same for all browser.
and I don't want any uploader package.
Thanks...

jquery preview modified image in dialog

I have a form with 2 file input which the user will select images to upload.
On submit when the images are uploaded, I first resize the image and merge it with another image using gd and this works fine.
What I want to do before the form is submitted, using Ajax on change of the file input, get the image, processes it on the server using gd (but not upload) and show the user the final result in a ui dialog for them to approve or not.
For reasons beyond my control I cannot use html5. I know you can't post files using Ajax and need to use jquery-iframe-transport or jquery-file-upload or some other plug-in like that.
What is recommended and how do I return the final image to display in the dialog, and if the user then click disapprove, how do I clear the file input field?
Thanks
Take a look at this: http://www.9lessons.info/2011/08/ajax-image-upload-without-refreshing.html
The above tutorial will show you how to do image upload using JQuery.
You can easily change the php file that handles the upload, show the image to the user, if they clicked disapprove, then simply remove the file from the server and start over.

how to make an interactive uploader like gmail and facebook have?

I want to make a interactive uploading option like Facebook and gmail have where they show the progress of the current file in uploading and then show the respective image or name of the file over there after the upload.
Right now, i'm using php and normal html for uploading where i send the file from one page to another where php handles it accordingly but i want a interactive one which show the progress also on the same page and then the name of the file after uploading without page refresh.
I knew, it can be done with ajax and css but i don't know how. All i want a interactive upload-er which uploads the file and then provide me the respective file name.
Gmail uses firefox file api, read more about it here https://developer.mozilla.org/en/Using_files_from_web_applications
Or check this live demo
http://robertnyman.com/html5/fileapi-upload/fileapi-upload.html
Hope this will help/solve ur problem ;) best luck

Take picture from local video source and submit via PHP form

How would I go about taking a picture from a video capture card or webcam? Should I use flash to do this? I want to submit the picture via a php form and upload it to my webserver and place a link to it in my MySQL database. Is there a flash app already built that I can use to perform this?
try this:
http://code.google.com/p/jpegcam/

Select multiple Image and upload atonce using PHP

I am using PHP5 and I want to create multiple file uploader of type Image, in such a way that user could select different images while holding Ctrl button and click mouse left button (While user doing so all images will push in an array) and when ever he click to Uplaod button then all images would be upload.
This can't be done using a normal upload dialogue: It supports only one file at a time (this changes in HTML 5, but it isn't there yet). Take a look at Flash based uploaders like SWFUpload or Uploadify.
Have a look at:
Upload Multiple Images at Once using PHP

Categories