I've been trying to find a solution to my problem for at least two weeks and I can not seem to make it work. The idea is this: I have an application Windows Forms
written in C#
, in which I will have a OpenFileDialog
that will select the path to a .png image or .jpg on the client computer , and selected this path, when I click save, the image needs to be renamed ( can be for date of day ), sent to a service in PHP
as in the example below:
<?php
if(isset($_FILES['fileUpload']))
{
//Pegando extensão do arquivo
$ext = strtolower(substr($_FILES['fileUpload']['name'],-4));
$name = $_FILES['fileUpload']['name'];
$dir = './upload/'; //Diretório para uploads
//Fazer upload do arquivo
move_uploaded_file($_FILES['fileUpload']['tmp_name'], $dir.$name);
echo("Imagen enviada com sucesso!");
}
Basically the idea is to upload images using C#
( from a client application Windows Forms
) and send it to PHP
() or direct to the destination directory on the server ).
The problem here is basically:
Catch the image
->
rename of the image->
send touploads
folder on the server.
Note: The image must be renamed before being sent to the server, since I associate the static name of the image with a record in the database to fetch the image later. / p>