I\'m using PHP, jQuery(jquery-1.9.1.min.js and jquery-ui-1.10.0.custom.min.js), AJAX, Bootstrap design framework(Bootstrap v3.0.0), etc.
I\'m relatively
Yes, it's possible. Here's something to get you started.
Note: This uses the PHP class class.upload.php
for uploading images. (http://www.verot.net/php_class_upload.htm)
All of this code has been tested and works. I just whipped it up, so it's pretty basic but should point you in the right direction. You'll need to sanitize inputs, do the correct messaging, etc.
Just create a file (index.html
) and copy/paste the HTML and JavaScript into it. Then create a file post.php
and put the PHP in it. Download the class.upload.php
script and then create a directory named uploads
. Give it the appropriate permissions (0755 or 0777). Keep everything in the same folder for this example. You should be good to go.
Edit: Added messaging to the example. :) Here's the HTML and jQuery ( And your PHP script (It's even possible to put the success and error messages right in the modal. I'm just using alert()
here for brevity. If you want to put the messages in the modal, just create a alert()
. It's pretty easy.
index.html
)
post.php
)allowed = 'image/*';
if($handle->uploaded) {
$handle->Process('uploads');
if($handle->processed) {
echo 'Image uploaded';
} else {
echo 'error';
}
}