473,406 Members | 2,713 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,406 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 9614
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 filename - is there a function that I can use to get...
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', which is only the filename itself. Thanks, Don ...
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 watching the directory and I get an created event....
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 firefox, this: MyInputField.postedfile.filename ...
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 ASP.NET 1.1 application uploading a very large...
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 ideas? the code is below: if($_POST ==...
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 user browse to a file on a mapped drive and get...
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 function with a hardcoded file path --C:\Temp.txt the...
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 i m not getting anyway to implement that......if...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...

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.