Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 250 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload File with CURL into Website

#1
I try to Upload a File into a Website with cURL on Windows CMD. The html-code looks like this:

<form enctype="multipart/form-data" action="/Filebrowser?Path=/S71500/" method="POST" onsubmit="return checkUploadFile()">
<td><input id="filebrowser_upload_filename" type="file" name="filename" size="30" maxlength="80" style="background-color: transparent;"></td>
<td><input type="submit" value="Datei laden"></td>
</form>

The command i am using is:

curl -F "filename=@/Users/Me/FILE.so"

[To see links please register here]


The fail-message is:

Warning: setting file FILE.so failed!
curl: (26) read function returned funny value

What am I doing wrong?
Reply

#2
You should place a PHP code in the root directory of your server as below

upload.php

<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['filename']['name']);
if(move_uploaded_file($_FILES['filename']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['filename']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>

keep in mind that you must use the argument a capital F (for Form). Lowercase f is for fail
Reply

#3
for me, it was a permissions thing. Curl wasn't able to read my file because it wasn't readable. try:

sudo chmod a+r /path/to/your/file

also, make sure to verify that you are logged in as either root or the owner of the file

ls -l /path/to/your/file

will give you info about permissions, ownership, and group for example:

-rw-r--r-- 1 me users 792139 Jul 2 11:23 file.txt

file.txt is readable by root, "me" and members of the group "users" - writable only by root, and not executable by anyone. it contains 792139 bytes
Reply

#4
I had the exact same error, while trying to upload with curl:

Warning: setting file testimage.png’ failed!

It comes out to be because my curl command line contained spurious invisible characters from a copy/paste from browser. I copied the command line into a text editor like Sublime Text and then back into terminal: suddenly everything worked.

Probably some UTF8 / ASCII issue.
Reply

#5
Instead of `-F`, we have to use `--form-string`. Then it will work.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through