Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sahar_mkr's avatar

send a file with CURL

Hi everyone, I have a file which comes from form-data in postman, I want to send that file to another api with curl, I don't want to save the file in my own app, read and send with curl, is it possible to directly get the file from postman and send it via curl without saving the file somewhere? I have the bellow array, when I use json_encode($array), there is not any file object in the result, where is the problem? and what can I do?

array:3 [ // app/Services/Finotech/RequestService.php:12
  "ibansFile" => 
Illuminate\Http
\
UploadedFile {#307
    -test: false
    -originalName: "file.csv"
    -mimeType: "text/csv"
    -error: 0
    #hashName: null
    path: "/tmp"
    filename: "php9gapoi"
    basename: "php9gapoi"
    pathname: "/tmp/php9gapoi"
    extension: ""
    realPath: "/tmp/php9gapoi"
    aTime: 2024-02-19 13:07:06
    mTime: 2024-02-19 13:07:06
    cTime: 2024-02-19 13:07:06
    inode: 292962
    size: 32
    perms: 0100600
    owner: 1000
    group: 1000
    type: "file"
    writable: true
    readable: true
    executable: false
    file: true
    dir: false
    link: false
  }
  "retry" => "true"
  "Id" => null
]
0 likes
1 reply

Please or to participate in this conversation.