Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I do this without a database on my web server? 2

Status
Not open for further replies.

Newb2IT

IS-IT--Management
Oct 6, 2008
205
US
I want is to create a new page form for customers to fill out....you know, with the usual
name...email..number etc etc etc and some of this fields mandatory and some optional...anyway the most important part of this form is for customers to have the capability to upload files...(with a
file size limit in case they try to upload a huge file)...as soon as they
click on the "submit" button the file that they attached (along with the
information that they entered in the form) should be emailed to a couple
of
email addresses directly...by directly I mean that the attachment should
not be saved on the website's sever...the file should be directly to me or
other
people that I select..reason for this is that we do not want to use hard
drive space on the server where the website is being hosted or have to
setup
a database on the server to host those attachemtns...(website is being
hosted by a third party)...is this possible? MY website supports php
 
Everything is possible but why don't these file uploaders send mail directly from their own mail client?

If you want to mask the recipients, you can simply create a new mail account that forwards to your intended recipients.
 
it is a weird situation....yes of course that would be the local thing to do (just have file uploaders email direcly from their email clients), but the BOSS wants website visitors to do it directly from our website...(upload files)
 
I guess I am just confused why you want to push files to a mail server instead of a web server. Moving files by email is much less efficient than HTTP or FTP as binary files must be encoded to text for mail transfer. A binary file converted to text is larger than its original binary file size. You're going to be taking up more space/bandwidth with your mail server than if you stored these same files on your web server.

If your current web server does not have storage for these files, I'd look to another server. You can get cheap shared hosting for less than $10/month.

Even if your web site supports PHP (and regardless of whether you want to store the file on the server or immediately kick it to email), you need to check your web server's POST limits in the PHP configuration file. Some servers may limit the file sizes that you can use, the amount of time an upload script may run (you don't want it to time-out in mid upload), and the amount of RAM you can use to process the file. For more info, check out the PHP forum here.
 
because if i wanted to use my webver to hold the files I believe i would have to setup a database like MySQL...I do not know databases..
 
You are operating under a few false beliefs. You might be relieved to learn the following...

1) MySQL is not typically ideal to store files. It is usually better to store files in the webserver's filesystem, not packed within a database. If you were to pack the files in a MySQL data table, you'd need the extra system resources for both MySQL and PHP to deliver the file to the web server to pass on to you. Having the HTTP server call the file from the filesystem directly uses less resources.

2) Just because you don't know database does not mean you cannot learn if you need to. Give yourself some credit. But if you feel you don't want to learn databases, recognize that there is plenty of other technology that you should know for this project. You cannot just jump into a project like this without recognizing security issues in uploading files.

3) Your situation is not unique and you do not need to reinvent the wheel. There are quite a few open source/GPL solutions already crafted by others that can manage file uploads. Take a look around Google.
 
spamjim thaks for your response, I really appreciate it.

I guess I should have asked "what is the best way to accomplish this...." Thanks for the calrification aobut MySQL, I was not aware that it is better to store files in the webserver's file system..I guess the best way for me to accomplish this is as you said by having the HTTP server call the file from the filesystem directly. I am assuming that I will be able to get an email letting me know that someone has uploaded a file correct? and I will be able to restrict the file size that they can upload?..and I am certainly more than willing to learn MYSql or any other technology that will help me accomplish the task in hand. I did take a look with google and found so many different ways to accomplish this..I just need to find out what is the most efficient and easiest way. Thanks again


 
Newb2IT,

For the uploading of the files, you can go a couple of different routes.

There are CMS packages, for instance, that allow you to create the whole site, if you want, and many of them include pre-programmed "plug-ins" that handle file uploading, etc.

If you're going to have multiple users, then I'd think a database option would be best. An open-source CMS such as Drupal or Joomla or phpBB, etc would be great for controlling user accounts, as well as setting up the user upload folders. For isntance, with Drupal, you don't have to really mess with the database part if you don't want to. I mean, you'll have to do a little, but you don't have to manually learn to create SQL queries and all that - you just need to create the database, then the username and password for Drupal for using the database. Then, there are a few different plug-ins (modules) you can use for allowing users to have set folders for uploading their files to, and then set what parts of the site each user/user group has access to. There are a lot of options, really.

I personally am mentioning Drupal b/c I just flat love using it, myself. I can dig in as little or as much as I want to, and get the job done. Take a look at for details on that. If you end up thinking you want to go the CMS route altogether, feel free to post more detailed/directed questions over in forum1246.

If you decide to manually control it, you'll just have to create users in your cpanel or whatever application you use with your webs server, and then create individual folders for individual people... or create one folder for all uploads, whatever. But I'd technically keep it "out" of the file system, if you will. Out of email, out of the database, and out of the file system. For instance, on many web servers, there's a public_http, a public_ftp, a private_http, etc. You could set up password-protected uploads, following that folder structure already in place.. just add sub-directories as/if necessary.

Also, your web host may have CGI scripts and such already set to cover some of this, and they may also support CMS installs, such as Drupal or Joomla.

Well, post back with further questions... if they get detailed to any particular area, be free to post in that forum, and put a link here to your new post.

--

"If to err is human, then I must be some kind of human!" -Me
 
ljv1611,

Thanks for your response, Drupal sounds like a very interesting solution, I will give it a try!

Thanks again
 
Here's some links that can give you some good insight, I think:

For additional modules (plugins) for the site, you can look at the site itself, but this site is better organized:

This site just lists various sites built on drupal:

I am thinking of at least one or two specific instances where schools changed over to drupal, but can't remember exactly the names.

Anyway, if that one doesn't work for you, don't give up hope. Drupal is VERY powerful, but some parts you have to do/learn a little bit of the technical side of things. It takes more learning with Drupal than say with Joomla, or so I've read. Also, Wordpress has nice setups that don't require you to learn practically anything to set up a functioning discussion forum type site. You can check those out as well.

--

"If to err is human, then I must be some kind of human!" -Me
 
An interesting point about not putting files in a DB. If a site were limited to one web server I would agree, but if you need to scale your site out, where would you put the files then?
An open question ,interested in anyones thinking.
 
...but if you need to scale your site out, where would you put the files then?

What's wrong with having a single file server location, even if you branch out your database servers? But if a project has gotten that big, I doubt that's an issue any longer. [wink] If you had to for that purpose, you could replicate files across multiple file servers if need be.

--

"If to err is human, then I must be some kind of human!" -Me
 
What's wrong with having a single file server location, even if you branch out your database servers?

I'm lost on that logic as it is the inverse of the mirroring server concept. Why would one need multiple database servers if the heavy lifting is being done by other file servers?

A single database server could direct clients to multiple file servers closest to them or with the lowest load at the time. This is assuming that the database server is used to store the file reference and the file servers are storing the actual file.

Scaling does not change the fact that more resources are needed to pull a file from a DB table than from a filesystem.
 
Scaling does not change the fact that more resources are needed to pull a file from a DB table than from a filesystem.
I hope I never gave that idea in my ramblings. Surely it'd be a given that a file left on a "file server" would be more appropriately placed than actually within a database. Regardless, a very good point to emphasize.

--

"If to err is human, then I must be some kind of human!" -Me
 
Yes I would estimate some 10 times (from my SQLServer days) longer to get a file from a DB rather than file server.
The most difficult server to scale is a DB one so yes in nearly all cases you would have a single data base. You might have several if you have the need for a lost of session information to be stored (for example) which is not shareable. You could map a session ID onto 1 of many database, theryby spreading the load.
What I was getting at with the file server scaling is if you had a site that had 10 web servers. My view is that the 10 servers make one large web server. You would have to chosse where you place your files for maximum resiliance. For example if you chosse to put all your files on server 5 and all the other servers "connect" here (using SAMBA or windows shares or similar) to get the files they want and server 5 went down or was taken out of service you would have an issue.
You could get another server and place nothing but files on it, but you would get the same problem as above if it fell over or was taken out of service. It would also have to be quite quick to service the 10 web servers.
You could put your files into a DB but if it fell over you have no files again.
You could put all the files on all the servers and each access the local storage for its files. This would be resillant but would probbaby be expensive on disc space and mainteance would be a nightmare not only at an application level but what if a new file were uploaded a server was out of service, something would have to catch it up quicly when it came back on line.
So not an easy one to solve and I don't think there is a sinlge answer - it depends on the size of your site. I like the idea of having one view of the truth be it app data or files so would be tempted to still put the files in the database and make sure it was a good size and well looked after.
 
No, there is not a single answer but it is often the last scenario where a file is duplicated across many servers. This is similar to a RAID or cloud computing. Most all of us already experience this in some way. If you have 'gmail' stored at Google, it is not all sitting on one server.

 
RAID is interesting, you get guaranteed consistency as RAID in it higher forms is all about that I recall RAID 0 is just a single disc (JBOD - Just a bunch of disks) , then you get 10 which I think is mirrored (two disks supporting the same data, a duplex write), then you get the striping options which might be RAID 11. Then we have the evil RAID 5, which some people say was only invented so Microsoft could support lots of space on a OS that could only support 26 drives. Anyhow RAID 5 is a parity based array , where the data load is spread over as many discs as you have in the array (with a min of 3) minus 1 for the parity information, so if you had an array of 10 20gb disks you would have 180gb available as a single drive. However because you have all these disks supporting a single write you will need n writes to support a physical write i.e. all the disks get involved so in my example you get 10 physical writes for every write you do. Commercial arrays have vast amounts of battery backed memory to get a good performance from this technology. With RAID 10 with the 10 disks you would get 5 lots of 2 * 20 = 200gb which not only gives you more space but allows you to balance IO across many physical disks, with the advent of huge discs (e.g. 1TB) is the requirement for RAID 5 as compelling as it once was. An advantage of RAID 5 is you can have a single disk fail and the array will continue to work. If you have hot swap disks you can replace it and the array will rebuild the information on the disk from the others. This also happens in mirrored drives.
From a DB perspective you would probably get away with RAID 5 for your data but I would never put high intensity writes such as log files on RAID 5.
The cloud is also interesting, the resilience is achieved by having multiple copies bit the copies are not asynchronous i.e. if there a 3 physical locations supporting your file then not all 3 are guaranteed to be physically updated before control returns the the user. This is often known as eventual consistency. Your application has to be aware of this. So in the GMAIL app I would imagine that all the data is sitting on the same server it just has multiple copies spread around the planet.
 
RAID is interesting, you get guaranteed consistency as RAID in it higher forms is all about that I recall RAID 0 is just a single disc (JBOD - Just a bunch of disks) , then you get 10 which I think is mirrored (two disks supporting the same data, a duplex write), then you get the striping options which might be RAID 11. Then we have the evil RAID 5,

Some of that is right on accurate, some is not. Just to be clear on at least some RAID configurations:
RAID 0 = Striped, 2 disks minimum, no redundancy, no true RAID - only used for performance reasons, and not a good choice for a web server for sure - hopefully never used in that situation.

RAID 1 = Mirrored, 2 disks minimum, exact duplicate of data on all disks in the array. So if any disk fails, there is at least one exact copy still working.

RAID 5 = Parity, 3 disk minimum, Data spread around with Parity so that if any one disk fails, there is still a working RAID array, but if another fails, yer toast. ;0) (well, in a 3 drive setup)

RAID 10 = A Striped Mirror (if I'm not remembering backwards). So you've got a Mirror (RAID 1) that is striped to another Mirror... The opposite is 0+1 which is a mirrorored STRIPE, between the two, for performance I'd go with the 0+1, for better redundancy, I'd go with the RAID 10... that is if I'm remembering this correctly - not backwards. LOL

RAID 3 - not mentioned, is mostly like a STRIPED RAID array with one Parity disk. It's actually very good for some applications, performance-wise, and can be very safe (like RAID 5) so long as the specific parity disk doesn't go on you. RAID 5 doesn't just limit parity to one single disk, but rather it's split over different disks - so that should make it safer than RAID 3. RAID 3 is not very common at all.

Of course, there are further variants as well, and there are plenty of web resources that lay out what all of them are, such as:


and


Overall, the cloud idea seems to be working really well where it's used. I know I've had GMAIL, for instance, for several years, and I still think it's the cream of the crop for free email accounts.

Well, I think this thread has really been derailed. Sure all of this is at least somewhat related, but definitely what the OP was asking about. [blush]

--

"If to err is human, then I must be some kind of human!" -Me
 
That's a good summary, the last time I went any where near disc techlogy was in 1998 when Data General sold me an Aviion server and Clariion disc array - not a bad memory for 13 years !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top