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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

upload_tmp_dir alternative? 3

Status
Not open for further replies.

Dweezel

Technical User
Joined
Feb 12, 2004
Messages
428
Location
GB
I've been constructing a web interface for my cousin to use on his site. One of the functions of this interface is to allow news items in the form of text and pictures to be uploaded to the site, via the browser using html form tags and PHP/MYSQL.
The problem I've encountered is that to upload files within html forms using php requires them to be loaded into a temporary file on the server, before being placed in the sites home directories.
This temporary upload directory is enabled within php by setting "upload_tmp_dir" in the php.ini file to a suitable directory.
The web hosting company in question will not set this up on their server as they say that they have in the past, and it was regularly abused(?)
Does anyone know of an alternative php upload method via a web browser interface.
Cheers.
 
If file uploads are disabled you cannot use PHP via a form to upload files. The only alternative I see is to use a custom ftp protocol based script that uploads directly into the location desired. As you probably have an ftp account that should be a viable solution.
 
Thanks for that DRJ.
 
Or you could....
use a hidden frame and POST the contents to the web server usign a JavaSscript
or
use the Micrrosoft XMLHTTP activeX to post to the web server
or
move ISP's
or
if moving ISP to too big a job use a cheap ISP solely to upload the file to and then issue a call to your original ISP server with a more friendy method.
If you interested post back and I'll expand (not literally !)
 
Thanks Ingresman. If you've got any links or info on the hidden frame and javascript method I'd be very grateful.
 
I'm a bit tied up and work this week, I'll try and pull something together for you
 
Hi Dweezel,

Good and bad news I'm afraid !
I had a play around with invoking functions in frames in the browser and I can happily do this by calling some PHP. The real problem is getting the file open to read, browsers can't really do this.
I'm now putting together a page which uses ODBC to read the local file and upload using the msxml component. I hope your on windows
More soon
 
Thanks Ingresman, and yes I am using windows. The msxml soloution sounds cool. I've never used that before, but it's about time I did something with xml ( I'm always about five years behind in adopting new web trends - example: I'm just learning PHP :-) )
 
Do you think installing PHP and Apache on my cousins computer is a sensible way around this problem? I could then use php ftp functions to make the whole thing work. I know it means that he won't be able to upload from any computer (which is obviously one of the main advantages of a web interface). But at least it would mean I could stick to my original plan of a custom designed, easy to understand interface.
Any thoughts?
 
I was thinkinig of a form based approach. I'd set up a shortcut on his desktop to an 'images' directory in Apache, into which he could drag any images he intended to use. He could then type the image name into a form field, and the title and content into other fields (also a SELECT dropdown to chose which section of the site to put the page in). These could then be passed forward as post variables to a php page that would first write all of the text content to files (fwrite) and then display the picture and content in a page template as it would appear on the web. A "SEND FILES" link at the bottom of this page could then pass the location of the picture and text files forward as variables(perhaps in the url) to the next page which could use ftp_connect, ftp_login and ftp_put commands to send the files to the remote server.
This would clearly only be a one part of the overall CMS.

What do you think?
 
Status
Not open for further replies.

Similar threads

Replies
3
Views
240
  • Locked
  • Question Question
Replies
6
Views
472
Replies
2
Views
200

Part and Inventory Search

Sponsor

Back
Top