Multiple File Upload PHP Ajax - php

I am looking for a ajax php uploader to uploads multiple files , i found some but unfortunately they did not work successfully with IE because IE 7 & 8 did not support
HTML5.
Uploadify & Plupload works fine with flash in IE but they did not return anything after uploading the file.In response i want the modified file name because before uploading a file i will modify the file name.
Any help or suggestion would be highly appriciated.
Thanks
Gaurav

Please refer this link for multiple file uploads using uploadify php - file uploads using uploadify
and in that link(in uploadify.php) replace the line
$fna = $_FILES['Filedata']['name'];
with
$fna = "your modified new filename";

Related

Adobe upload cannot read stream in PHP

The file is small about 4 to 5Kb.
I am trying to upload a fillable pdf to an Apache server.
The pdf has a submit button which uploads the PDF to a Zend IndexController using
$request=$this->getRequest();
$tempFile=time().'.pdf';
file_put_contents("data/tmp/".$tempFile, $request->getContent());
I am now trying to do the same in Drupal 7 to no avail. $_POST and $_FILES are both empty.
If I use an HTML form the file will upload, however, I want the end user to click on the button within the form.
I also tried
file_put_contents("data/tmp/".$tempFile, "php://input");
Which created the PDF file on the server, but it unfortunately only contains the text "php://input".
Can someone please advise how to do this?
Dale's answer
file_put_contents("data/tmp/".$tempFile, file_get_contents("php://input"));
is correct

How to upload csv file by class.upload.php?

I am using upload php class from this site: http://www.verot.net/
Image upload is working fine. But when I try to upload csv file it throughs an error:
getimagesize(): Read error! [APP\Vendor\class.upload.php, line 2423]
Here is my code:
$upload = new Upload($file['file']);
$upload->no_script = false;
$upload->allowed = array('application/msword');
$upload->file_new_name_body = 'data';
$upload->process($this->target_path);
if (!$upload->processed) {
$msg = $this->generateError($upload->error);
$this->Session->setFlash($msg);
return $this->redirect($this->referer());
}
Here $file has the all info of attached file.
If I try to upload an image it works fine but when I try to upload a csv file it shows error. I set the mime-type. But no luck. Anyone have this experience. Or is there any plugin like verot.net to upload file. Any idea will be appreciated
This tutorial guides you trought file uploading process:
W3Schools: File Upload
File uploading is not very hard, so I suggest you to try learning it.
Hope this helps!
Your class file is meant to upload or resize image files only.
It will not work for other extensions like .csv, .txt or any other text file or non image file.
I was searching answer to your same question and got that this class should work fine with any other file upload . You just need to set the following for all files other than image
$upload->mime_getimagesize = false;
This will not throw the error you mentioned for non image files

blueimp/jQuery-File-Upload direct upload to S3

I'm trying to implement blueimp jquery uploader. I want it to upload directly to S3 (without PHP script in the middle). I found an example here and followed the steps and it worked (partially). But I could not find anything good for muti-file upload.
What I want to do is to have multiple file uploader with a UI feedback just like in this example.
Does anybody have an example to follow for this scenario?
Thanks for your help.
I couldn't get blueimp to perfectly upload to s3, it would still take advantage of my servers tmp folder.
I ended up switching over to plupload which does upload directly to s3, and has a built in UI ( I just created my own to match the rest of my site).
Uploading Directly to S3
Full Example
I'm not using the multiple file feature but you could do something like
foreach file you are uploading:
var multipart_params = {
'key': config['key'],
'Filename': config['key'],
'acl': 'public-read',
'Content-Type': '',
'AWSAccessKeyId': config['awskey'],
'policy': config['policy'],
'signature': config['signature']
};
up.settings.multipart_params = multipart_params;
up.start();
Hope that helps :)

How I can uploads text files with HTML 5?

I have following problem. I use this tutorial to creating a multiple file uploader:
http://tutorialzine.com/2011/09/html5-file-upload-jquery-php/
But this code uploding only IMAGES. I want this code to upload text files, not images. Is there a possibility to happen.
In file script.js i changed a type of file with this code, but don't work.
// Called before each upload is started
beforeEach: function(file){
if(!value.match(/\.(txt)|(csv)$/)){
alert('Only TXT and CSV files!');
// Returning false will cause the
// file to be rejected
return false;
}
},
The error message after uploadied files is "Your browser does not support HTML5 file uploads!"
What changes should I make to work correctly?
Thanks in advace !
http://www.script-tutorials.com/pure-html5-file-upload/

Getting a file from a form in Zend

I'm trying to upload a file to Amazon S3 using Zend. Everything is working except I can't get access to the file in the POST[] array.
Is there anyway I can easily take the file from the form. All the documentation examples only show you how to do this when uploading a file to your local file system.
It is quite straight forward once you get the hang of it.
$form->image->setDestination('path/to/images');
if($form->isValid($_POST)){
if($form->image->isUploaded()){
if($form->image->receive()){
// For example, get the filename of the upload
$filename = $form->image->getFilename();
}
} else {
// Not uploaded
}
} else {
// Not valid
}
Note that in my example image is the name of the upload element.
A small correction on the above it should be getFileName with a capital N.
$filename = $form->image->getFileName();
If you are uploading a file to your PHP script from a form, and then intend to upload that file to S3, you're looking in the wrong superglobal.
File uploads live in $_FILES, not $_POST. Check out the PHP documentation on handling file uploads for information on how to use it best.

Categories