Is it possible to upload a file in php without form tag browse button and upload button.
if particular file exist in folder i want to upload that file to server..how it is possible
Is it possible to upload a file in php without form tag browse button and upload button.
if particular file exist in folder i want to upload that file to server..how it is possible
— the key thing is to separate two different situations: the file you want to "upload" is either on the visitor's machine, or it already lives on the web server. Those are handled very differently.
If the file is on a visitor's PC there is no safe, standards-compliant way for a web page to read or send that file without an explicit user action. Browsers block silent access for security and privacy. Common, user-driven options are a visible file input, drag-and-drop, or the newer File System Access APIs — all require the user to choose or confirm the file. The only ways around that are out-of-browser solutions (a native app, background agent, or browser extension) which must be installed and explicitly granted permissions.
If the file already exists on the server, PHP can move or copy it without any form input. The usual pattern is: check the file exists and is readable, validate it is inside an allowed directory, then copy/rename it to the destination. Example (server-side only):
$allowedBase = '/var/www/data';
$source = realpath('/var/www/data/special.txt');
if ($source && strpos($source, $allowedBase) === 0 && is_readable($source)) {
$dest = '/var/www/uploads/' . basename($source);
if (copy($source, $dest)) {
// success
} else {
// handle copy error
}
} else {
// source missing or not allowed
} Security notes: run these operations only on server-controlled paths (use realpath and compare to a whitelist), enforce file-type and size checks, give uploaded files safe unique names, ensure upload directories are not executable by the webserver, and handle permissions and error logging. In short, as hinted, you cannot silently pull files from a user's PC — but if the file is already on your server, PHP can handle it directly with the checks above.
Jump to Post— jkon 738You can't upload any file in the file system from the PC of the user without letting her / him choose what to upload. There are many ways to upload something (even without a form button , or even without a POST or even GET) but the user must select …
guys plzzzzz help
You can't upload any file in the file system from the PC of the user without letting her / him choose what to upload. There are many ways to upload something (even without a form button , or even without a POST or even GET) but the user must select the file to be uploaded.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.