473,413 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

uploading defined file

xxoulmate
how can i upload a file on server.

<?php
$filename = "c:\file.txt";

?>

i want to upload the $filename on the server is there a way for it.,
Oct 8 '09 #1
6 1464
Dormilich
8,658 Expert Mod 8TB
in most cases you use a form to upload the data from the client computer. (see also this article).

if you want to trigger that from the server side, you probably need to use cURL (no success guaranteed).
Oct 8 '09 #2
how about not using the input file.,

is there a functions in php that can upload just set the file path to be upload.
e.g. c:\upload.txt
Oct 9 '09 #3
TheServant
1,168 Expert 1GB
@xxoulmate
Not PHP. I am 99.9% sure you can't do that with any web language. The reason is that the web needs to go through your browser, if the clients browser let you access files like that, the security risk would be so massive, I would not be on the internet. Having said that, *maybe* something can be done with vb.net or asp, but if you did find that this was possible, the potential for stealing files would risk you being held accountable... For uploads, you are better off just trying a traditional upload input.

Anyway, not all computers will be set up the same with the same file path.
Oct 9 '09 #4
how about., instead of input file to use,
input text will be use as the file to be uploaded.
Oct 9 '09 #5
Dormilich
8,658 Expert Mod 8TB
that is, so to speak, the classical way of form processing (only that you save the text to file in the end).
Oct 9 '09 #6
TheServant
1,168 Expert 1GB
@xxoulmate
That is fine, but possibly a little overkill from totally automated to totally user submitted. Can you elaborate on what you're trying to do and maybe we can give you better suggestions?

If not then a simple textarea which gets processed to become a file (look up "php create file" if you're unsure) will do the trick. Just remember you really should be inspecting and sanitizing the user submitted data.

Rule #1 of PHP programming (and most user interacting languages) is trust no one!

What is in your text file you're looking for? Better than a big textarea for users to put what they want, would be a series of inputs where you can check that the data matches what it should. Checking one large text block is more involed/risky than a few smaller ones.
Oct 9 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Kevin Ollivier | last post by:
Hi all, I've come across a problem that has me stumped, and I thought I'd send a message to the gurus to see if this makes sense to anyone else. =) Basically, I'm trying to upload a series of...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
1
by: Sheldon Glickler | last post by:
I am having a problem uploading on one system and not on another with very similar code in two different applications. I suspect that it has to do with server settings. Here is the code that...
5
by: Chris | last post by:
I have a meetings section I'm developing on our intranet. Using PHP/MySQL. Meeting info and Meeting docs reside on 2 related tables in the db. Users may want to upload anywhere from 1 to 10 or...
1
by: sean | last post by:
Hi, I am a complete novice but would liket to have a PHP script which will upload a file which is pre-defined, without the need for the user to 'Browse' for a file path. For example, the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.