6 Replies - 739 Views - Last Post: 09 July 2013 - 10:38 AM Rate Topic: -----

#1 likenoother31  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-December 09

Php script to upload file from client's computer to server

Posted 09 July 2013 - 09:45 AM

So before I tell you my specific issue, what I am trying to create is a C# application that will manage user's shared presets for a guitar pedal. So in order to do this, I need the ability to upload files from the user's computer, to my server/hosting.

I could use built in C# libraries to make an ftp connection and upload files to my server, but then my precious information would be exposed and vulnerable to being seen regardless of my attempts to encrypt/obfuscate the code.

So in order to protect my information I want to create a php script to do the uploading, but I need to invoke the php script from my C# application. I can easily make webrequests in C# to php pages, which I am doing now to server the data from my database, but uploading files to my server is quite different.

Anyone know how I might do this?

Is This A Good Question/Topic? 0
  • +

Replies To: Php script to upload file from client's computer to server

#2 BetaWar  Icon User is online

  • #include "soul.h"
  • member icon

Reputation: 1147
  • View blog
  • Posts: 7,134
  • Joined: 07-September 06

Re: Php script to upload file from client's computer to server

Posted 09 July 2013 - 09:54 AM

I hate to tell you this, but unless you are running a secure connection all traffic and file uploads you do over the internet is send in an insecure manner. Sure you can use the POST method to hide the information from the address bar, but it is still sent in plain text.

If you are really worried about security I would suggest looking into something like a SFTP (secure FTP) which should be encrypted before the file transfer begins. I wouldn't be surprised if there are libraries built in to C# for SFTP, then you just need to get the server-side application running an SFTP server and everything should go fairly smoothly.

You could also look in to SCP (secure copy).

Hope that helps.
Was This Post Helpful? 0
  • +
  • -

#3 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5246
  • View blog
  • Posts: 27,063
  • Joined: 10-May 07

Re: Php script to upload file from client's computer to server

Posted 09 July 2013 - 10:08 AM

1.) If this is for C#, why did you post under php?
2.) I wrote something like this in C years ago. If you don't need any user interaction, & they understand enough to move the files to a specific folder on their system, just write a script.

The reason for my program in C was so the user could have the file named whatever they wanted, & the program renamed it so the script could take over.

PHP? There is no need for server side processing with an old technology such as file transfers, imo.
Was This Post Helpful? 0
  • +
  • -

#4 likenoother31  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-December 09

Re: Php script to upload file from client's computer to server

Posted 09 July 2013 - 10:08 AM

View PostBetaWar, on 09 July 2013 - 09:54 AM, said:

I hate to tell you this, but unless you are running a secure connection all traffic and file uploads you do over the internet is send in an insecure manner. Sure you can use the POST method to hide the information from the address bar, but it is still sent in plain text.

If you are really worried about security I would suggest looking into something like a SFTP (secure FTP) which should be encrypted before the file transfer begins. I wouldn't be surprised if there are libraries built in to C# for SFTP, then you just need to get the server-side application running an SFTP server and everything should go fairly smoothly.

You could also look in to SCP (secure copy).

Hope that helps.


I understand that the data won't be secure, however I want my server information to be secure. If I use C# libraries to connect to my ftp for example, my information will be in the code itself and be vulnerable to being decompiled.

What I want to do is pass the file somehow to the php script which then will upload the file to my server. Can this be done?
Was This Post Helpful? 0
  • +
  • -

#5 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5246
  • View blog
  • Posts: 27,063
  • Joined: 10-May 07

Re: Php script to upload file from client's computer to server

Posted 09 July 2013 - 10:10 AM

View Postlikenoother31, on 09 July 2013 - 01:08 PM, said:

I understand that the data won't be secure, however I want my server information to be secure. If I use C# libraries to connect to my ftp for example, my information will be in the code itself and be vulnerable to being decompiled.

It isn't decompiling you need to worry about. ANY data transferred over ftp is done so in plane text. That includes user name & password. Think in packets, not just payload. Data is more than just the file being uploaded.
Was This Post Helpful? 0
  • +
  • -

#6 likenoother31  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-December 09

Re: Php script to upload file from client's computer to server

Posted 09 July 2013 - 10:13 AM

View Postno2pencil, on 09 July 2013 - 10:08 AM, said:

1.) If this is for C#, why did you post under php?
2.) I wrote something like this in C years ago. If you don't need any user interaction, & they understand enough to move the files to a specific folder on their system, just write a script.

The reason for my program in C was so the user could have the file named whatever they wanted, & the program renamed it so the script could take over.

PHP? There is no need for server side processing with an old technology such as file transfers, imo.


The reason I posted it as a php question, is because I know how to do the C# code for my issue, I don't know how to upload a file directly from a clients computer using php though.

I want to upload using php so that my server information cannot be exposed to the user.

View Postno2pencil, on 09 July 2013 - 10:10 AM, said:

View Postlikenoother31, on 09 July 2013 - 01:08 PM, said:

I understand that the data won't be secure, however I want my server information to be secure. If I use C# libraries to connect to my ftp for example, my information will be in the code itself and be vulnerable to being decompiled.

It isn't decompiling you need to worry about. ANY data transferred over ftp is done so in plane text. That includes user name & password. Think in packets, not just payload. Data is more than just the file being uploaded.


Ok. So is there a solution to protecting my server information?
Was This Post Helpful? 0
  • +
  • -

#7 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5246
  • View blog
  • Posts: 27,063
  • Joined: 10-May 07

Re: Php script to upload file from client's computer to server

Posted 09 July 2013 - 10:38 AM

As suggested, psftp, or have them use a form to upload & bypass the entire C#/ftp mess.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1