-1

I am writing a PHP app with Laravel 5. It manages medical images it will have a RESTful API for getting info on stored files and storing new images.

I have a lot of the GET API commands working and am able to upload image files through an HTML form but I would like to be able to upload file(s) via the API. Could somebody please help with an example of how to pass a file this way rather than with an HTML form? For instance, something like this:

myapp.com/file/upload?file=myfile.dcm

Just a pointer in the right direction would be very helpful.

Thanks.

Garry Pettet
  • 8,096
  • 22
  • 65
  • 103

1 Answers1

0

The html form is creating a POST request for the server, for your upload.php.

This is how your POST looks like:

        [name] => 
        [type] => 
        [tmp_name] => 
        [error] => 
        [size] => 

You can build this post manually too. Check the reference:

http://php.net/manual/en/features.file-upload.post-method.php http://php.net/manual/en/reserved.variables.files.php

Geseft
  • 317
  • 1
  • 7