Jump to content

Upload files with jQuery uploader


mvdesign
 Share

Recommended Posts

Hi everyone,

I'm working on a project where users can upload images, using a jquery uploader (no $_FILES input in the form) :

- User select images

- Images are uploaded in a specific folder

After that, how can i attach the images to a page ?

I took a look to wireupload() but it seems to need a $_FILES input.

Thanks for you help :)

Link to comment
Share on other sites

Hi mvdesign,

Not sure I understand you correctly. But also when uploading with a "Jquery Uploader", the files are processed somehow server-side (PHP). And in PHP, accessing the uploaded files is done over the $_FILES array.

Anyway, if the files are stored in a directory on your server, you can attach them to your pages like this.

Note that this is code written in the browser and not tested. You can attach multiple images for example by looping through the files in your directory.

$p = $pages->get('/path/to/my/page/');
$image = '/path/to/my/image.jpg';
$p->of(false);
$p->images = $image;
$p->save();
$p->of(true);
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...