Jump to content

How to create a Free file hosting website.


shata

Recommended Posts

Hi there, i was wondering if anyone can help me. Ive looked on google for a open srouce program that lets people upload files to your site and then lets other people download them.Im not sure if this will be possible but i have a site with 500gb space and 5TB bandwidth.Any points will help, thanks.

Link to comment
Share on other sites

hi, are u looking for the code sample wherein people can upload and downmload documents thru ur site...If so, then u can go thru two options:1. Create a share at ur wqebsite for storing, uploading and downloading files via ur WebPage2. Store the files in SQL DB and then p[rovide the uploading and downloading of file.s......for thi su can use the nvarchar, ntext, image data types.....

Link to comment
Share on other sites

hi, are u looking for the code sample wherein people can upload and downmload documents thru ur site...If so, then u can go thru two options:1. Create a share at ur wqebsite for storing, uploading and downloading files via ur WebPage2. Store the files in SQL DB and then p[rovide the uploading and downloading of file.s......for thi su can use the nvarchar, ntext, image data types.....
Oh alright im kinda confused on what your talking about. Can you explain a little more what i need for either. Like where i need to go to get the code or if there is a php mysql i can use or somthing.
Link to comment
Share on other sites

Well, i haven't worked with PHP....but can give u a code sample for ASP.Net/C# for working this out......this is for the option 1 i.e Uploading and Downloading thru Folders.....for the second option, u can cehck for the SQL Queries related to the nchar, ntext(8Kb), and image(2MB) types.....for Downloading a file

string fileName = GridView2.Rows[e.NewSelectedIndex].Cells[2].Text;		Response.ContentType = "application/octet-stream";		Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);		Response.Flush();		Response.WriteFile(@"c:\TCSMSRelations\Downloads\" + ProjectName + @"\" + fileName);		Response.End();

For Uploading a File

FileStream newFile = new FileStream(Location of the Share in ur Site+FileName, FileMode.Create);			// Get Size of file			int nFileLen = FileUpload1.PostedFile.ContentLength;			// Allocate a buffer for reading of the file			byte[] myData = new byte[nFileLen];			// Read uploaded file from the Stream			//FileDownload1.SaveAs(@"C:\MyFile");			FileUpload1.PostedFile.InputStream.Read(myData, 0, nFileLen);			//newFile.InputStream.Read(myData, 0, nFileLen);			// Write data to the file			newFile.Write(myData, 0, myData.Length);			// Close file			newFile.Close();

Similarly u can workout by creating Directories to sort out data as and when required ---- to give it a more Ordered Look.......To improve on style, u can add a table in ur SQL which contains the details of the (fileName, fileType, pathOfFile, dateOfFileCreation)......this way, u can manage each file download by just looking for the file in SQL, getting the file path, and using the downstream ----- and for uploading, adding a new row to the file table with the correct DbPath.......

Link to comment
Share on other sites

Well, i haven't worked with PHP....but can give u a code sample for ASP.Net/C# for working this out......this is for the option 1 i.e Uploading and Downloading thru Folders.....for the second option, u can cehck for the SQL Queries related to the nchar, ntext(8Kb), and image(2MB) types.....for Downloading a file
string fileName = GridView2.Rows[e.NewSelectedIndex].Cells[2].Text;		Response.ContentType = "application/octet-stream";		Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);		Response.Flush();		Response.WriteFile(@"c:\TCSMSRelations\Downloads\" + ProjectName + @"\" + fileName);		Response.End();

For Uploading a File

FileStream newFile = new FileStream(Location of the Share in ur Site+FileName, FileMode.Create);			// Get Size of file			int nFileLen = FileUpload1.PostedFile.ContentLength;			// Allocate a buffer for reading of the file			byte[] myData = new byte[nFileLen];			// Read uploaded file from the Stream			//FileDownload1.SaveAs(@"C:\MyFile");			FileUpload1.PostedFile.InputStream.Read(myData, 0, nFileLen);			//newFile.InputStream.Read(myData, 0, nFileLen);			// Write data to the file			newFile.Write(myData, 0, myData.Length);			// Close file			newFile.Close();

Similarly u can workout by creating Directories to sort out data as and when required ---- to give it a more Ordered Look.......To improve on style, u can add a table in ur SQL which contains the details of the (fileName, fileType, pathOfFile, dateOfFileCreation)......this way, u can manage each file download by just looking for the file in SQL, getting the file path, and using the downstream ----- and for uploading, adding a new row to the file table with the correct DbPath.......

Cool thank you. For the help im going to give this a try this weekend.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...