Php upload file using web service soap

In php file upload can be done easily if you know the logic of file system.What we need to do is create simple nusoap server that have method of two parameters.one parameter is for file name and one parameter is for base64 encoded string of file contents.

when client make request it must have to pass file as base64 encoded format.When server receive file it simply convert base64 decode string and put contents to file.Here attached example we simply pass image to server.

You can download and see demo

Client

1)In line no 6 change “http://127.0.0.1:80/webservice_file_transfer/nusoap/server/server.php?wsdl” to your corresponding url

2)In line no 17 chnage “D:/NIK/MyPictures/myphoto/nik.jpg” with your file path.This is the file which is transferred

3)In line no 21 change  array(‘filename’ => ‘nik.jpg’  to your desired file name

Server

Your file is created in server folder to change it please chnage line no 28 to
$fp = fopen(“Your Folder path/”$pFilename, ‘w’);

Download Now





Download full example here