upload

PHP read from uploaded text file?

China☆狼群 提交于 2019-12-03 02:41:00
问题 If I upload a text file via a form, is it possible to output its contents directly from the $_FILES variable rather than saving it onto the server first? I know this is a security risk, but it will only be run on a local machine. Any advice appreciated. Thanks. 回答1: The file is saved to temp directory the moment it's uploaded, but you can use $_FILES['uploadedfile']['tmp_name'] to read it without having to save in a permanent place. 回答2: Doing file_get_contents($_FILES['uploadedfile']['tmp

Node.js Busboy parse fields and files seperatly

﹥>﹥吖頭↗ 提交于 2019-12-03 01:32:24
I was wondering if it is possible to get Busboy to parse the fields and files separately. (I have removed bodyParser as you can fill the hard drive with temp files very easily.) For instance - middleware which parsers post fields (used on all POST requests) if (req.method === 'POST') { var form = new busboy({ headers: req.headers, limit: { files: 0 } }); form.on('field', function (fieldname, val, valTruncated, keyTruncated) { req.params.body[fieldname] = val; }); form.on('finish', function () { next(); }); return req.pipe(form); } else { next(); } Then on upload pages use the following, which

Drag & Drop File Upload

柔情痞子 提交于 2019-12-03 01:22:22
问题 So I'm struggling a bit to find what I'm looking for and how to implement it. I have a basic PHP file uploader working, in that a user presses a custom upload button, selects a file and then using JS, it checks for a change (Ie. the user selecting a file) and then submits the form which uploads the image fine. What I also want now is a drag & drop to upload area. So the user can drag an image from their file explorer and drop it in a designated place (not the whole page) and then once that

Having problems with uploading photos to TwitPic using OAuth in Objective C on the iPhone

前提是你 提交于 2019-12-03 00:52:13
I have been working on an iPhone app that has a feature of uploading photos to TwitPic. I have it working with basic authentication. I am trying to get it working with OAuth. I am getting authentication errors. I have studied very carefully the TwitPic documentation. I am authorising the app by displaying a UI Web View and the it returns a PIN value. I enter the PIN value in the app and request the token. I am able to upload status updates to Twitter but not photos. My code is based on some example code from here: Example iPhone app using OAuth Here is my code: NSString *url = @"http://api

Upload Data to Meteor / Mongo DB

时光怂恿深爱的人放手 提交于 2019-12-03 00:37:57
I have a Meteor app and would like to upload data (from csv) to a meteor collection. I have found: solutions (e.g. Collectionfs ) which deal with file uploads methods for uploading directl y to the underlying mongo db from the shell references to meteor router - but I am using the excellent iron-router , which does not appear to provide this functionality My requirement is that the app user be able to upload csv data to the app from within the app. I do not need to store the csv file anywhere within the app file structure, I just need to read the csv data to the collection. It is possible that

generate random string in php for file name [duplicate]

馋奶兔 提交于 2019-12-03 00:28:23
This question already has an answer here: PHP: How to generate a random, unique, alphanumeric string? 27 answers How would I go about creating a random string of text for use with file names? I am uploading photos and renaming them upon completion. All photos are going to be stored in one directory so their filenames need to be unique. Is there a standard way of doing this? Is there a way to check if the filename already exists before trying to overwrite? This is for a single user environment (myself) to show my personal photos on my website however I would like to automate it a little. I don

Uploading a File via SCP with Maven fails

橙三吉。 提交于 2019-12-02 23:37:43
I try to upload an ear created by maven to an application server using scp. When I tried to run mvn wagon:upload-single But I get the following error: [ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0-beta-3:upload-single (default-cli) on project de.volkswagen.dps.ear: Unable to create a Wagon instance for null: url can not be null -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0-beta-3:upload-single (default-cli) on project de.volkswagen.dps.ear: Unable to create a Wagon instance for null

Software error while executing CGI script

孤人 提交于 2019-12-02 23:37:32
问题 I have a cgi script for upload which is as follows #!/usr/bin/perl use CGI; use CGI::Carp qw(fatalsToBrowser); my $cgi = new CGI; my $file = $cgi->param('file'); $file=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filename my $name = $2; open(LOCAL, ">/home/Desktop/$name") or die $!; while(<$file>) { $data .= $_; } print $cgi->header(); print "$file has been successfully uploaded... thank you.\n"; print $data; The HTML file is as follows <html> <head> <title>Test</title> </head>

I am so confused with uploading files in PHP

好久不见. 提交于 2019-12-02 22:20:27
问题 I have tried reading multiple tutorials, the PHP documentation and have no idea what I am doing. Here is my form <form action="beta_upload.php" enctype="multipart/form-data" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="20971520" /><!-- 20 Meg --> <input type="file" name="file[]" /> <input type="file" name="file[]" /> <input type="file" name="file[]" /> <input type="submit" value="submit" name="submit" /> </form> Now when I send that through here: <?php $username = trim($

Upload Excel File and display in Grid in asp.net MVC

江枫思渺然 提交于 2019-12-02 21:15:37
I need to export the Users List from excel to my asp.net mvc(C#) application. The Excel should have an header like First Name Last Name Email ,... and its values like John Smith john@gmail.com, David Beckam david@gmail.com, Need to validate the values before storing it to my database and show it in the grid of next page. Is there any easy way to do it, like a plugin? Mike Rosenblum I think that it would be best, in this case, to use ADO.NET. A few articles on how to do this in order to read values from an Excel Worksheet: (1) Reading and Writing Excel Spreadsheets Using ADO.NET C#