472,352 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

how to get complete path while in file uploading

254 100+
Hi

I want to get the complete path of a file when we are uploading any image or file.
Apr 7 '09 #1
15 9517
hsriat
1,654 Expert 1GB
what exactly did you mean?
Apr 10 '09 #2
mukeshrasm
254 100+
@hsriat
when we are uploading file it takes path and I want to get that complete path
Apr 13 '09 #3
mfaisalwarraich
194 100+
when you are trying to upload a file then u have to define a path where u have to move the uploaded file. please go through move_uploaded_file at php.net. this will give u comprehensive details or try to look at google.
Apr 15 '09 #4
mukeshrasm
254 100+
@mfaisalwarraich
Thanks! dude I will definetly look at php.net
Apr 15 '09 #5
mfaisalwarraich
194 100+
mukesh try to use getcwd() function this will return the path of the current working directory.

Expand|Select|Wrap|Line Numbers
  1.  
  2. echo getcwd();
  3.  
  4.  
Apr 15 '09 #6
mukeshrasm
254 100+
@mfaisalwarraich
Hi

I don't want the path of current working directory. What i wanted is when we are uploading any image we browse that file from local machine say from c:\program files\mukesh.gif. so this path comes in input type file's text box. I want to get this path and wanted to show that image for preview purpose to user so that he/she can know what kind of image they are going to upload before uplaoding image in any html element like div or span.

if u need further clarification feel free to ask but please help me out
Apr 16 '09 #7
Dormilich
8,658 Expert Mod 8TB
@mukeshrasm
looks more like a job for JavaSript (kind of validation). once you submit the form, you have already uploaded the image. it would be a waste of time and bandwidth if the user decides to not take this image.
Apr 16 '09 #8
mukeshrasm
254 100+
@Dormilich
before uploading image i want to show the preview of image
Apr 16 '09 #9
Dormilich
8,658 Expert Mod 8TB
you can use Javascript to get the path from the input field (field.value), create an <img> and pass this value to the src attribute.
Apr 16 '09 #10
mukeshrasm
254 100+
@Dormilich
I tried in this way

Expand|Select|Wrap|Line Numbers
  1.  function getimagefile ()
  2. {
  3.     var path= document.getElementById("imagepath").value
  4.     document.getElementById("getfile").src=path;//this works fine in ie but not in mozila firefox
  5.     //and I tried this as well but this not working in either ie or mozila 
  6.     document.getElementById("getfile").src = window.opener.document.getElementById("imagepath").innerText
  7. }
  8.  

Expand|Select|Wrap|Line Numbers
  1. <input type="file"  id="imagepath" name="mukesh" onchange="getimagefile()"/>
  2. <img id="getfile" src="" />
  3.  
  4.  
Apr 18 '09 #11
Dormilich
8,658 Expert Mod 8TB
a trial gave (FF 3.0.8, Mac OS 10.5.6)
- onchange didn't fire, so using onblur
- only filename was submitted
Apr 18 '09 #12
mukeshrasm
254 100+
@Dormilich
yes only filename was submitted in firefox and sorry I didn't get your a trial gave (FF 3.0.8, Mac OS 10.5.6)
Apr 18 '09 #13
hsriat
1,654 Expert 1GB
@mukeshrasm
This is not possible with JavaScript. But only "Java" can do this, like in Facebook image upload.
Apr 18 '09 #14
mukeshrasm
254 100+
@hsriat
but I am working in java and i am using php so how this will be done in php or javascript
Apr 18 '09 #15
Markus
6,050 Expert 4TB
@mukeshrasm
It is not possible in PHP, either. You have to upload the image first in order to access it.

A java applet will make it possible though, as said before.
Apr 18 '09 #16

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

Similar topics

1
by: Ralph Freshour | last post by:
I'm reading the php manual to find out how to get the path of a file I'm uploading from my PC - I'm using the $_FILES var but that is just the...
9
by: Don | last post by:
How do I retrieve the full path (C:\.....filename) of a file uploaded to a php script on the server. I think $_FILES will only provide 'name',...
12
by: Anders Eriksson | last post by:
Hello! I'm trying to create a program that will watch a directory and when a file is created print that file. I have used FileSystemWatcher for...
10
by: darrel | last post by:
I have an input type="file" field that I am using to accept a file upload. This works, but I'm having problems with the filename property. In...
2
by: bostonnole | last post by:
I am getting this WinIOError "Insufficient system resources exist to complete the requested service" when I try to execute the following code in an...
1
by: Glenn Coyle | last post by:
Hi I am having trouble writing the file path of a image to the database,also for some reason it is not uploading the images, anyone have any...
4
by: DMG | last post by:
I have <identity impersonate = "true" /& <authentication mode="Windows"/in the web.config. This is a 2.0 site. My Goal: I want to simply have the...
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my...
4
by: ish | last post by:
hello everybody...... plz help me out... how we can store the acual path of uploading file.i want to store the path of file in my database...bt...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.