[VB] Upload files to cPanel File Manager/server

  • (2 Pages)
  • +
  • 1
  • 2

19 Replies - 501 Views - Last Post: 15 July 2019 - 10:09 AM Rate Topic: -----

#1 jimble   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 14-July 19

[VB] Upload files to cPanel File Manager/server

Posted 14 July 2019 - 09:48 PM

My website; "example.com" has a folder called files. AKA example.com/files
I can't work out how to make my VB program be able to upload a file selected from client computer to the "files" folder. I don't know how to get the address to upload, what permissions are required, etc.

I am using a Hostinger server with CentOS7 cPanel, which is attached to a registered domain. I have a working database, my VB application and SELECT and INSERT no problem.

Please help!

Is This A Good Question/Topic? 0
  • +

Replies To: [VB] Upload files to cPanel File Manager/server

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15268
  • View blog
  • Posts: 61,205
  • Joined: 12-June 08

Re: [VB] Upload files to cPanel File Manager/server

Posted 14 July 2019 - 10:02 PM

Have you considered using FTP/SFTP?
Was This Post Helpful? 0
  • +
  • -

#3 jimble   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 14-July 19

Re: [VB] Upload files to cPanel File Manager/server

Posted 14 July 2019 - 10:17 PM

View Postmodi123_1, on 14 July 2019 - 10:02 PM, said:

Have you considered using FTP/SFTP?


I am unsure of how that works but I am interested if it helps my problem! Please share
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15268
  • View blog
  • Posts: 61,205
  • Joined: 12-June 08

Re: [VB] Upload files to cPanel File Manager/server

Posted 14 July 2019 - 10:32 PM

A quick bit of reading should help.

"msdn vb.net ftp"

https://docs.microso...etframework-4.8
https://code.msdn.mi...Upload-e06faeaa
https://www.codeproj...library-for-NET
Was This Post Helpful? 0
  • +
  • -

#5 jimble   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 14-July 19

Re: [VB] Upload files to cPanel File Manager/server

Posted 14 July 2019 - 10:49 PM

View Postmodi123_1, on 14 July 2019 - 10:32 PM, said:




I have had a good look and tried implementing a few things but none of it is successful and I'm almost pulling my hair out here. I am very new to this and I really don't understand why it can't be as simple as

My.Computer.Netowrk.UploadFile("example.com/files", "local_file_directory", "username", "password")


Please give me a hand with this, I am clearly misunderstanding something.
Was This Post Helpful? 0
  • +
  • -

#6 DarenR   User is offline

  • D.I.C Lover

Reputation: 634
  • View blog
  • Posts: 4,209
  • Joined: 12-January 10

Re: [VB] Upload files to cPanel File Manager/server

Posted 15 July 2019 - 05:47 AM

you need something like the following:


created directory if it doesnt exist
 if Directory.Exists(String.Concat(Server.MapPath("~/Uploads/")))
            _path = String.Concat(Server.MapPath("~/Uploads/"))
        Else
            Directory.CreateDirectory(String.Concat(Server.MapPath("~/Uploads/")))
            _path = String.Concat(Server.MapPath("~/Uploads/"))
        End If



get the file ---- fileUploadCompare = the fileupload asp.net tool :


<asp:FileUpload ID="fileUploadCompare"   runat="server"/>




 _filePath = String.Concat(Server.MapPath("~/Uploads/") + Path.GetFileName(fileUploadCompare.PostedFile.FileName))
        fileUploadCompare.SaveAs(_filePath)


Was This Post Helpful? 0
  • +
  • -

#7 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15268
  • View blog
  • Posts: 61,205
  • Joined: 12-June 08

Re: [VB] Upload files to cPanel File Manager/server

Posted 15 July 2019 - 06:59 AM

waaaaaaaait.. is this a VB.NET desktop app or ASP.NET webform?
Was This Post Helpful? 0
  • +
  • -

#8 DarenR   User is offline

  • D.I.C Lover

Reputation: 634
  • View blog
  • Posts: 4,209
  • Joined: 12-January 10

Re: [VB] Upload files to cPanel File Manager/server

Posted 15 July 2019 - 07:44 AM

i assumed it was asp since he said this :

Quote

Hostinger server with CentOS7 cPanel


server to me indicates asp but i could be wrong


so which is it OP?
Was This Post Helpful? 0
  • +
  • -

#9 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15268
  • View blog
  • Posts: 61,205
  • Joined: 12-June 08

Re: [VB] Upload files to cPanel File Manager/server

Posted 15 July 2019 - 08:04 AM

Haha! I was indexing off "VB program".
Was This Post Helpful? 0
  • +
  • -

#10 DarenR   User is offline

  • D.I.C Lover

Reputation: 634
  • View blog
  • Posts: 4,209
  • Joined: 12-January 10

Re: [VB] Upload files to cPanel File Manager/server

Posted 15 July 2019 - 08:28 AM

maybe the OP is confused -- who knows lol
Was This Post Helpful? 0
  • +
  • -

#11 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2942
  • View blog
  • Posts: 11,426
  • Joined: 03-December 12

Re: [VB] Upload files to cPanel File Manager/server

Posted 15 July 2019 - 09:06 AM

I'm curious why you are going this route to begin with?

There are ancillary routes you could take depending on what the circumstances are.

Why not give them a user account to upload directly in CPanel?
Upload them to a password protected site and it processes it to move the file to the proper location?
Use something like WinSCP or FileZilla?
Was This Post Helpful? 0
  • +
  • -

#12 jimble   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 14-July 19

Re: [VB] Upload files to cPanel File Manager/server

Posted 15 July 2019 - 09:21 AM

To clear up confusion:

I am writing a VB.NET application which works similarly to social media sites. You can create an account, login to the account, share pictures, receive likes, comments, etc. That part should be fairly straightforward to understand. What the application does is, through MySQL it connects to my Hostinger serverís database for the users, posts, comments, etc. My application is already capable of MySQL SELECT and INSERT commands to the database; meaning I can allow people to register, login, comment, like, etc. The question I was asking here was that last part; sharing files. I wanted a way to upload a user file to the serverís files.

HOWEVER; I have no found a far better strategy that is no more complicated than my registering process: I set the image field to a LONGBLOB. When uploading the image, it gets the bytes and uses INSERT just like any other command. And then later that LONGBLOB can be retrieved perfectly. This is exactly what I wanted, however do feel free to continue to discuss an answer to my initial question!
Was This Post Helpful? 0
  • +
  • -

#13 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2942
  • View blog
  • Posts: 11,426
  • Joined: 03-December 12

Re: [VB] Upload files to cPanel File Manager/server

Posted 15 July 2019 - 09:27 AM

View Postjimble, on 15 July 2019 - 11:21 AM, said:

I set the image field to a LONGBLOB. When uploading the image, it gets the bytes and uses INSERT just like any other command. And then later that LONGBLOB can be retrieved perfectly.

That makes this more convoluted. If you are saving the image to the database (which I would recommend you not do) why do you care about the uploads directory to begin with?
Was This Post Helpful? 0
  • +
  • -

#14 jimble   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 14-July 19

Re: [VB] Upload files to cPanel File Manager/server

Posted 15 July 2019 - 09:30 AM

View Postastonecipher, on 15 July 2019 - 09:27 AM, said:

View Postjimble, on 15 July 2019 - 11:21 AM, said:

I set the image field to a LONGBLOB. When uploading the image, it gets the bytes and uses INSERT just like any other command. And then later that LONGBLOB can be retrieved perfectly.

That makes this more convoluted. If you are saving the image to the database (which I would recommend you not do) why do you care about the uploads directory to begin with?


This method isnít complicated at all, I am satisfied with the result, so I do not see any issue here. I also do not have any issue
Was This Post Helpful? 0
  • +
  • -

#15 DarenR   User is offline

  • D.I.C Lover

Reputation: 634
  • View blog
  • Posts: 4,209
  • Joined: 12-January 10

Re: [VB] Upload files to cPanel File Manager/server

Posted 15 July 2019 - 09:31 AM

ewe dont save images to db


save them to a file folder and just reference them in the db well unless you want you db to grow exponentially
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2