Jmeter manual file upload Post request - php

after strugelling for about a week to get an old ASP.net site to accept a multipart form Post request I finally got it to work with a bit of a work around the trick is that Jmeters multipart form functionallity wasnt working properly for this site, so now i have to write the Post request in the Body manually. But the problem is again on the upload file part. I am able to upload empy .txt files but i am unable to upload .png .jpeg i susspect that i am doing something wrong. I read on a site that i am supposed to use _FileToString somehow to upload an existing file but i have no idea how i am supposed to do that.
Full POST request image
WebKitFormBoundaryBbo97BWEj5UehRpp
Content-Disposition: form-data; name="ctl00$ContentPlaceHolder1$8$9$fu_appDocument$fu_document";
filename="StacktraceKnijki.png"
Content-Type: image/png
Can someone help me turn this into a working upload file request? Thank you.

Why don't you just record the file upload request using JMeter's HTTP(S) Test Script Recorder? JMeter should be smart enough to produce the relevant HTTP Request sampler from the captured request.
The only pre-requisite is having your StacktraceKnijki.png file in JMeter's "bin" folder during the recording process, see Recording File Uploads with JMeter guide for more details.

Related

How to upload videos as a file directly to server using Alamofire 5?

I wish to upload a video file stored on the mobile device on which the app is downloaded, to a folder within my server (ran with PHP). I am trying to use Alamofire to do this, and it said in their documentation that I should NOT use multipart form data for this as it could be too slow/memory intensive. Instead, I am using, as was recommended in the Alamofire documentation, this code to upload the video file directly to the server:
AF.upload(videoURL, to: "[string of url of my server folder]")
Here, videoURL is the local url of the video (an mp4 file) on the phone.
Now, as for the url to my server, if I just put in the the path to the folder, the return string I get just seems to scrape the HTML code of the web page that you get when you past in the link into a browser, and the file is not uploaded.
Then, if I write a path to a new file within the folder that doesn't already exist, the error message just says:
The requested URL was not found on this server.
Lastly, I have tried passing in the url of an already existing mp4 file with a video in the server folder, hoping that when I upload to this url, this video will then be replaced by my video file. However, what gets returned as a message from the server then is a very (very) long string (making Xcode very laggy) that I believe is some representation of the current video already in the file, and on the server the video has not been replaced.
So, I have tried these three different possibilities, but none of them seem to get the file uploaded to the server. Do you have any idea what the problem is? Do I need to do something server side, with PHP code, or is it fine as it is just trying to upload the video like this? According to what I could find in the documentation, this seems to me like it should be ok.
Link to documentation: https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md

curl file upload details

I have a custom system running on a server which expects a certain file type.
when uploading a file via posts, the $_FILES variable in PHP contains information such as [type] = image/png. Where does this information come from?
When i manually try to curl to my website via SSH, and i add -F "file=#/a/b/c/d.pqx" the type is set to "application/octet-stream".
Is the curl command translating the uploaded file and suppling this information or is the server/php parsing the file and providing this information?
Is it possible to make a POST request to my website and have the filetype show up as "application/pqx" (pqx is a custom file extension) ? I am more interested in a way to make the right POST request rather than changing the PHP code. Can i customize the curl request to the website and supply the filetype myself?
thanks for all your help!

Blueimp jQuery File Upload Delete aborted chunked uploads from server-side?

I'm using Blueimp jQuery File Upload with chunked uploads to handle large files, and everytime file upload are completed or file are removed, I update the client's disk space used in database.
My problem is: when the upload process is interrupted, I just can delete incomplete file from client-side by using fail callback to send a DELETE request to server, like this guide : https://github.com/blueimp/jQuery-File-Upload/wiki/Chunked-file-uploads#deleting-aborted-chunked-uploads.
But if clients' internet connections has been lost or the browser is closed, the server will not get any request, there's no update in database too, and the corrupted file still exists. When the client re-connects to the site and remove file, it will cause wrong amount of disk space used in database.
Is there any way to remove imcomplete file of chunked upload from server-side or another solution for my case ? Please help me.

Basic steps for setting up file upload on website

I'm trying to set up a file upload for my website but I'm not sure what I'd need to get this to work overall. I'm trying to use Jquery File Upload but I can't seem to get the files to upload to my server. It looks like I might need something else to get it to run but I'm not sure what. Any suggestions?
There are three "sides" to a file upload.
First is client-side: You need to have a form that can upload files (so you need to set the enctype attribute of your form element, and set your action to post).
Second is server-side: You need something that can handle the file upload. Assuming you're using a server with PHP, you can access the file via $_FILES['filename']. Google has a vast array of example for handling file uploads.
Third is server-side (again) - your server must allow file uploads. Not only must it allow file uploads, but it restricts the size of the file that can be uploaded (php config).
However, it looks like jquery file upload has a PHP file handler.
I will sugest you use dreamweaver its easy to use expecially to upload files to the web n you can also see the steps needed in its help content. or you may download an ftp uploader

How do I create a PHP page which can accept file uploads?

I want to upload a file to my server from some application. How can I code a PHP page to accept this file?
The application should just include the file in an HTTP POST request as would an HTML form with an input of type file. In the PHP code, the posted file contents would be available in the $_FILES array.
Lots more information here.
Keep in mind that the concept of a "file" doesn't mean the same thing over HTTP that it does on a local computer or on the target server. In HTTP, the "file" is just a stream of data wrapped in an HTTP request or response with a given content type and various other headers, no different from a web page or an image or any other request/response.
I would suggest reading the PHP manual chapter on handling file uploads

Categories