upload

PHP upload fail (empty $_FILES)

萝らか妹 提交于 2019-12-09 20:40:20
问题 I have a common problem in PHP : My $_FILES array is empty when files are too big. php.ini : max_execution_time = 300000 max_input_time = 600000000 memory_limit = 5100MB post_max_size = 5000MB upload_max_filesize = 5000MB The file : Trouve.tar : 910Mo Configuration values are huge but I want to be sure that the script have the time and the memory to do the upload. So, the authorized size is bigger than the file size, but I have the same error than other people (like problem with uploading the

Scan PHP uploads for viruses

若如初见. 提交于 2019-12-09 20:25:07
问题 I'm currently using the following code to scan files that have been uploaded as part of an application form: $safe_path = escapeshellarg($dir . $file); $command = '/usr/bin/clamscan --stdout ' . $safe_path; $out = ''; $int = -1; exec($command, $out, $int); if ($int == 0) { // all good; } else { // VIRUS!; } It works, but is slow. Anyone got any suggestions that would a). speed things up and b). improve the script generally (for instance, I'm not entirely clear on the benefits of exec() vs

Sending data from Android device to server in the background with minimal user impact

给你一囗甜甜゛ 提交于 2019-12-09 19:36:31
问题 I have an app that generates data that needs to be sent to my server eventually (several hours of delay are no problem at all). I would like to do this with minimal impact to the user, which means to me: Minimal battery use No extra permissions, especially not "sketchy" ones No other strange changes to the system (see example later) So far I've found three approaches, that all have some serious problems: Using a SyncAdapter triggered by a network message: Technically, this sounded like the

android - send parameters while uploading file

纵饮孤独 提交于 2019-12-09 19:34:43
问题 I've got this piece of code http://pastebin.com/VrMNuxcv which successfully uploads a file onto the server from my android. I'd like to , however to be able to send a couple of string parameters together with it. Could you please tell me, if possible, where exactly I need to do this in that piece of code and how? Thanks Andreas 回答1: I assume that you're in control of how the server processes the upload, i.e., you wrote the server code too??? If so, I simply use custom/private request

How do you add drag-n-drop upload ability from Outlook to a Web form?

旧巷老猫 提交于 2019-12-09 18:05:59
问题 I am looking for a way to allow users to upload Outlook emails to a web-based system in a simple manner. I can get this to work in a manual fashion for the users. They can drag and drop the email from Outlook to their desktop, which creates a .msg file. This works very nicely, esp. if there are attachments in the email which are also stored in the .msg file. This file can then be uploaded using a traditional "input type=file" html field. I would like to simplify this process, if possible. I

Multiple file upload DRF

痴心易碎 提交于 2019-12-09 16:32:38
问题 I have a requirement which I would like to allow multiple files to be uploaded within the same post request to create an object. I currently have a method of doing this, but after looking at some other examples it doesn't appear to be intended way to do it. models.py class Analyzer(models.Model): name = models.CharField(max_length=100, editable=False, unique=True) class Atomic(models.Model): name = models.CharField(max_length=20, unique=True) class Submission(models.Model): class Meta:

Provide a callback URL in Google Cloud Storage signed URL

↘锁芯ラ 提交于 2019-12-09 16:11:41
问题 When uploading to GCS (Google Cloud Storage) using the BlobStore's createUploadURL function, I can provide a callback together with header data that will be POSTed to the callback URL. There doesn't seem to be a way to do that with GCS's signed URL's I know there is Object Change Notification but that won't allow the user to provide upload specific information in the header of a POST, the way it is possible with createUploadURL's callback. My feeling is, if createUploadURL can do it, there

Can I trust the file type from $_FILES?

喜你入骨 提交于 2019-12-09 15:57:18
问题 Can I trust the file type from $_FILES when uploading images? Or do I have to check again with exif_imagetype() ? 回答1: From the documentation: The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted. 回答2: No you cannot trust the $_FILES['userfile']['type'] variable. The value present in this variable could be forged. You can use finfo_file to

How to Get File Name from Upload Form Using jQuery?

百般思念 提交于 2019-12-09 14:57:42
问题 I want to get the file name of the uploaded file using jQuery. But the problem, I got the fake path and file name, instead of the file name only. This is my form. <form action="" method="post"> <input type="file" name="uploadFile" id="uploadFile" /> <input type="submit" name="submit" value="Upload" id="inputSubmit" /> </form> And the jQuery is like this $(document).ready(function(){ $('#inputSubmit').click(function(){ alert($('#uploadFile').val()); }); }); I use Chrome and got this in the

$_FILES array is not empty upon uploading nothing

Deadly 提交于 2019-12-09 14:40:23
问题 Here is the form form action="index.php" method="POST" enctype="multipart/form-data" > <input type="file" name="image[]" multiple="multiple"> <input type="submit" value="upload"> </form> I am trying to only run my code when only when if(!empty($_FILES['image'])){ but for some reason the array is not empty upon submitting no files and only clicking submit. Here is the rest of the code if that will help, thanks. <html> Image Upload <form action="index.php" method="POST" enctype="multipart/form