how to get image file from absolute path in php2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?PHP: Delete an element from an arrayHow do I get PHP errors to display?How do I get a YouTube video thumbnail from the YouTube API?How to get the client IP address in PHPHow do I auto-resize an image to fit a div containerHow Do You Parse and Process HTML/XML in PHP?How to vertically align an image inside a div?How does PHP 'foreach' actually work?Using curl to upload POST data with files
What does it mean to make a bootable LiveUSB?
Humanity loses the vast majority of its technology, information, and population in the year 2122. How long does it take to rebuild itself?
Does splitting a potentially monolithic application into several smaller ones help prevent bugs?
Where is the 1/8 CR apprentice in Volo's Guide to Monsters?
Counting certain elements in lists
How to answer questions about my characters?
Bash replace string at multiple places in a file from command line
Calculus II Professor will not accept my correct integral evaluation that uses a different method, should I bring this up further?
Possible Leak In Concrete
Why do Australian milk farmers need to protest supermarkets' milk price?
Replacing Windows 7 security updates with anti-virus?
Why would a flight no longer considered airworthy be redirected like this?
PTIJ: Who should pay for Uber rides: the child or the parent?
Can the damage from a Talisman of Pure Good (or Ultimate Evil) be non-lethal?
Brexit - No Deal Rejection
How to write cleanly even if my character uses expletive language?
Sword in the Stone story where the sword was held in place by electromagnets
Is it normal that my co-workers at a fitness company criticize my food choices?
What are the possible solutions of the given equation?
Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?
Does this AnyDice function accurately calculate the number of ogres you make unconcious with three 4th-level castings of Sleep?
Do I need life insurance if I can cover my own funeral costs?
How could a female member of a species produce eggs unto death?
Science-fiction short story where space navy wanted hospital ships and settlers had guns mounted everywhere
how to get image file from absolute path in php
2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?PHP: Delete an element from an arrayHow do I get PHP errors to display?How do I get a YouTube video thumbnail from the YouTube API?How to get the client IP address in PHPHow do I auto-resize an image to fit a div containerHow Do You Parse and Process HTML/XML in PHP?How to vertically align an image inside a div?How does PHP 'foreach' actually work?Using curl to upload POST data with files
I have absolute path of my uploaded image file and i want to get image file which i uploaded in my folder. So how can i get image file and how i can upload image.So i can perform image operation like watermark and rotate. So i have to get image file in code igniter.
i tried but it is not working
$upld_file = 'my absolute path';
$real_path = realpath($upld_file);
$img = base64_encode($real_path);
and i send $img parameter to upload image
I am getting "you did not select a file to upload"
C:wamp64wwwcodeigniter_projectassets/images/1551892667300.jpeg
This is my absolute path of my image
Thank You.
php image codeigniter file-upload upload
add a comment |
I have absolute path of my uploaded image file and i want to get image file which i uploaded in my folder. So how can i get image file and how i can upload image.So i can perform image operation like watermark and rotate. So i have to get image file in code igniter.
i tried but it is not working
$upld_file = 'my absolute path';
$real_path = realpath($upld_file);
$img = base64_encode($real_path);
and i send $img parameter to upload image
I am getting "you did not select a file to upload"
C:wamp64wwwcodeigniter_projectassets/images/1551892667300.jpeg
This is my absolute path of my image
Thank You.
php image codeigniter file-upload upload
1
You have not actually loaded the file into PHP anywhere. All you are doing is fiddling with a string containing a path and filename
– RiggsFolly
Mar 7 at 12:30
actually my question is how can i get file from path. and i am able to get file so i can re_upload
– Urvish Patel
Mar 7 at 12:33
Seefile_get_contents()
in the PHP Manual
– RiggsFolly
Mar 7 at 12:33
file_get_contents return string in my project but how can i send string for upload image in php
– Urvish Patel
Mar 7 at 12:37
add a comment |
I have absolute path of my uploaded image file and i want to get image file which i uploaded in my folder. So how can i get image file and how i can upload image.So i can perform image operation like watermark and rotate. So i have to get image file in code igniter.
i tried but it is not working
$upld_file = 'my absolute path';
$real_path = realpath($upld_file);
$img = base64_encode($real_path);
and i send $img parameter to upload image
I am getting "you did not select a file to upload"
C:wamp64wwwcodeigniter_projectassets/images/1551892667300.jpeg
This is my absolute path of my image
Thank You.
php image codeigniter file-upload upload
I have absolute path of my uploaded image file and i want to get image file which i uploaded in my folder. So how can i get image file and how i can upload image.So i can perform image operation like watermark and rotate. So i have to get image file in code igniter.
i tried but it is not working
$upld_file = 'my absolute path';
$real_path = realpath($upld_file);
$img = base64_encode($real_path);
and i send $img parameter to upload image
I am getting "you did not select a file to upload"
C:wamp64wwwcodeigniter_projectassets/images/1551892667300.jpeg
This is my absolute path of my image
Thank You.
php image codeigniter file-upload upload
php image codeigniter file-upload upload
asked Mar 7 at 12:25
Urvish PatelUrvish Patel
14
14
1
You have not actually loaded the file into PHP anywhere. All you are doing is fiddling with a string containing a path and filename
– RiggsFolly
Mar 7 at 12:30
actually my question is how can i get file from path. and i am able to get file so i can re_upload
– Urvish Patel
Mar 7 at 12:33
Seefile_get_contents()
in the PHP Manual
– RiggsFolly
Mar 7 at 12:33
file_get_contents return string in my project but how can i send string for upload image in php
– Urvish Patel
Mar 7 at 12:37
add a comment |
1
You have not actually loaded the file into PHP anywhere. All you are doing is fiddling with a string containing a path and filename
– RiggsFolly
Mar 7 at 12:30
actually my question is how can i get file from path. and i am able to get file so i can re_upload
– Urvish Patel
Mar 7 at 12:33
Seefile_get_contents()
in the PHP Manual
– RiggsFolly
Mar 7 at 12:33
file_get_contents return string in my project but how can i send string for upload image in php
– Urvish Patel
Mar 7 at 12:37
1
1
You have not actually loaded the file into PHP anywhere. All you are doing is fiddling with a string containing a path and filename
– RiggsFolly
Mar 7 at 12:30
You have not actually loaded the file into PHP anywhere. All you are doing is fiddling with a string containing a path and filename
– RiggsFolly
Mar 7 at 12:30
actually my question is how can i get file from path. and i am able to get file so i can re_upload
– Urvish Patel
Mar 7 at 12:33
actually my question is how can i get file from path. and i am able to get file so i can re_upload
– Urvish Patel
Mar 7 at 12:33
See
file_get_contents()
in the PHP Manual– RiggsFolly
Mar 7 at 12:33
See
file_get_contents()
in the PHP Manual– RiggsFolly
Mar 7 at 12:33
file_get_contents return string in my project but how can i send string for upload image in php
– Urvish Patel
Mar 7 at 12:37
file_get_contents return string in my project but how can i send string for upload image in php
– Urvish Patel
Mar 7 at 12:37
add a comment |
3 Answers
3
active
oldest
votes
You don't need to get the absolute path of the image if you are storing the images inside a assets
in the root of your project directory, You can access the image like this
echo base_url('assets/images/1551892667300.jpeg');
NOTE : you need to load the url helper first
1
yes but how can i get file from path ? how can i re_upload in php?
– Urvish Patel
Mar 7 at 12:32
What do you mean by re_upload?
– RopAli Munshi
Mar 7 at 12:33
actually it is stored in my images folder but i want to perform image operation for update image file so i need to get my image file in php
– Urvish Patel
Mar 7 at 12:34
If you want perform image operations then just provide that path to any method you want
– RopAli Munshi
Mar 7 at 12:36
add a comment |
You can try like this..
//define image path
$filename="C:/wamp64/www/codeigniter_project/assets/images/1551892667300.jpeg";
// Load the image
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, 90, 0);
//and save it on your server...
imagejpeg($rotate, "savedestinationpath.jpg");
i tried but it returns "pathinfo() expects parameter 1 to be string"
– Urvish Patel
Mar 7 at 12:41
add a comment |
That should be the file input name. eg: If your file browse input name is myFileInput
then it should be $this->upload->do_upload('myFileInput')
Also make sure that you have set attribute enctype="multipart/form-data"
for your form.
One nice example is here
no i don't want to get absolute path i want file.
– Urvish Patel
Mar 7 at 12:56
$this->upload->do_upload('what i pass in this') how can i get image field name
– Urvish Patel
Mar 7 at 12:59
That should be the file input name. eg: If your file browse input name ismyFileInput
then it should be$this->upload->do_upload('myFileInput')
– Saji
Mar 7 at 13:01
Also make sure that you have set attributeenctype="multipart/form-data"
for your form.
– Saji
Mar 7 at 13:02
@UrvishPatel I have updated the answer based on your input here.
– Saji
Mar 7 at 13:14
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55043757%2fhow-to-get-image-file-from-absolute-path-in-php%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You don't need to get the absolute path of the image if you are storing the images inside a assets
in the root of your project directory, You can access the image like this
echo base_url('assets/images/1551892667300.jpeg');
NOTE : you need to load the url helper first
1
yes but how can i get file from path ? how can i re_upload in php?
– Urvish Patel
Mar 7 at 12:32
What do you mean by re_upload?
– RopAli Munshi
Mar 7 at 12:33
actually it is stored in my images folder but i want to perform image operation for update image file so i need to get my image file in php
– Urvish Patel
Mar 7 at 12:34
If you want perform image operations then just provide that path to any method you want
– RopAli Munshi
Mar 7 at 12:36
add a comment |
You don't need to get the absolute path of the image if you are storing the images inside a assets
in the root of your project directory, You can access the image like this
echo base_url('assets/images/1551892667300.jpeg');
NOTE : you need to load the url helper first
1
yes but how can i get file from path ? how can i re_upload in php?
– Urvish Patel
Mar 7 at 12:32
What do you mean by re_upload?
– RopAli Munshi
Mar 7 at 12:33
actually it is stored in my images folder but i want to perform image operation for update image file so i need to get my image file in php
– Urvish Patel
Mar 7 at 12:34
If you want perform image operations then just provide that path to any method you want
– RopAli Munshi
Mar 7 at 12:36
add a comment |
You don't need to get the absolute path of the image if you are storing the images inside a assets
in the root of your project directory, You can access the image like this
echo base_url('assets/images/1551892667300.jpeg');
NOTE : you need to load the url helper first
You don't need to get the absolute path of the image if you are storing the images inside a assets
in the root of your project directory, You can access the image like this
echo base_url('assets/images/1551892667300.jpeg');
NOTE : you need to load the url helper first
answered Mar 7 at 12:30
RopAli MunshiRopAli Munshi
566416
566416
1
yes but how can i get file from path ? how can i re_upload in php?
– Urvish Patel
Mar 7 at 12:32
What do you mean by re_upload?
– RopAli Munshi
Mar 7 at 12:33
actually it is stored in my images folder but i want to perform image operation for update image file so i need to get my image file in php
– Urvish Patel
Mar 7 at 12:34
If you want perform image operations then just provide that path to any method you want
– RopAli Munshi
Mar 7 at 12:36
add a comment |
1
yes but how can i get file from path ? how can i re_upload in php?
– Urvish Patel
Mar 7 at 12:32
What do you mean by re_upload?
– RopAli Munshi
Mar 7 at 12:33
actually it is stored in my images folder but i want to perform image operation for update image file so i need to get my image file in php
– Urvish Patel
Mar 7 at 12:34
If you want perform image operations then just provide that path to any method you want
– RopAli Munshi
Mar 7 at 12:36
1
1
yes but how can i get file from path ? how can i re_upload in php?
– Urvish Patel
Mar 7 at 12:32
yes but how can i get file from path ? how can i re_upload in php?
– Urvish Patel
Mar 7 at 12:32
What do you mean by re_upload?
– RopAli Munshi
Mar 7 at 12:33
What do you mean by re_upload?
– RopAli Munshi
Mar 7 at 12:33
actually it is stored in my images folder but i want to perform image operation for update image file so i need to get my image file in php
– Urvish Patel
Mar 7 at 12:34
actually it is stored in my images folder but i want to perform image operation for update image file so i need to get my image file in php
– Urvish Patel
Mar 7 at 12:34
If you want perform image operations then just provide that path to any method you want
– RopAli Munshi
Mar 7 at 12:36
If you want perform image operations then just provide that path to any method you want
– RopAli Munshi
Mar 7 at 12:36
add a comment |
You can try like this..
//define image path
$filename="C:/wamp64/www/codeigniter_project/assets/images/1551892667300.jpeg";
// Load the image
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, 90, 0);
//and save it on your server...
imagejpeg($rotate, "savedestinationpath.jpg");
i tried but it returns "pathinfo() expects parameter 1 to be string"
– Urvish Patel
Mar 7 at 12:41
add a comment |
You can try like this..
//define image path
$filename="C:/wamp64/www/codeigniter_project/assets/images/1551892667300.jpeg";
// Load the image
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, 90, 0);
//and save it on your server...
imagejpeg($rotate, "savedestinationpath.jpg");
i tried but it returns "pathinfo() expects parameter 1 to be string"
– Urvish Patel
Mar 7 at 12:41
add a comment |
You can try like this..
//define image path
$filename="C:/wamp64/www/codeigniter_project/assets/images/1551892667300.jpeg";
// Load the image
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, 90, 0);
//and save it on your server...
imagejpeg($rotate, "savedestinationpath.jpg");
You can try like this..
//define image path
$filename="C:/wamp64/www/codeigniter_project/assets/images/1551892667300.jpeg";
// Load the image
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, 90, 0);
//and save it on your server...
imagejpeg($rotate, "savedestinationpath.jpg");
answered Mar 7 at 12:38
rajeevrajeev
1057
1057
i tried but it returns "pathinfo() expects parameter 1 to be string"
– Urvish Patel
Mar 7 at 12:41
add a comment |
i tried but it returns "pathinfo() expects parameter 1 to be string"
– Urvish Patel
Mar 7 at 12:41
i tried but it returns "pathinfo() expects parameter 1 to be string"
– Urvish Patel
Mar 7 at 12:41
i tried but it returns "pathinfo() expects parameter 1 to be string"
– Urvish Patel
Mar 7 at 12:41
add a comment |
That should be the file input name. eg: If your file browse input name is myFileInput
then it should be $this->upload->do_upload('myFileInput')
Also make sure that you have set attribute enctype="multipart/form-data"
for your form.
One nice example is here
no i don't want to get absolute path i want file.
– Urvish Patel
Mar 7 at 12:56
$this->upload->do_upload('what i pass in this') how can i get image field name
– Urvish Patel
Mar 7 at 12:59
That should be the file input name. eg: If your file browse input name ismyFileInput
then it should be$this->upload->do_upload('myFileInput')
– Saji
Mar 7 at 13:01
Also make sure that you have set attributeenctype="multipart/form-data"
for your form.
– Saji
Mar 7 at 13:02
@UrvishPatel I have updated the answer based on your input here.
– Saji
Mar 7 at 13:14
|
show 1 more comment
That should be the file input name. eg: If your file browse input name is myFileInput
then it should be $this->upload->do_upload('myFileInput')
Also make sure that you have set attribute enctype="multipart/form-data"
for your form.
One nice example is here
no i don't want to get absolute path i want file.
– Urvish Patel
Mar 7 at 12:56
$this->upload->do_upload('what i pass in this') how can i get image field name
– Urvish Patel
Mar 7 at 12:59
That should be the file input name. eg: If your file browse input name ismyFileInput
then it should be$this->upload->do_upload('myFileInput')
– Saji
Mar 7 at 13:01
Also make sure that you have set attributeenctype="multipart/form-data"
for your form.
– Saji
Mar 7 at 13:02
@UrvishPatel I have updated the answer based on your input here.
– Saji
Mar 7 at 13:14
|
show 1 more comment
That should be the file input name. eg: If your file browse input name is myFileInput
then it should be $this->upload->do_upload('myFileInput')
Also make sure that you have set attribute enctype="multipart/form-data"
for your form.
One nice example is here
That should be the file input name. eg: If your file browse input name is myFileInput
then it should be $this->upload->do_upload('myFileInput')
Also make sure that you have set attribute enctype="multipart/form-data"
for your form.
One nice example is here
edited Mar 7 at 13:14
answered Mar 7 at 12:49
SajiSaji
735414
735414
no i don't want to get absolute path i want file.
– Urvish Patel
Mar 7 at 12:56
$this->upload->do_upload('what i pass in this') how can i get image field name
– Urvish Patel
Mar 7 at 12:59
That should be the file input name. eg: If your file browse input name ismyFileInput
then it should be$this->upload->do_upload('myFileInput')
– Saji
Mar 7 at 13:01
Also make sure that you have set attributeenctype="multipart/form-data"
for your form.
– Saji
Mar 7 at 13:02
@UrvishPatel I have updated the answer based on your input here.
– Saji
Mar 7 at 13:14
|
show 1 more comment
no i don't want to get absolute path i want file.
– Urvish Patel
Mar 7 at 12:56
$this->upload->do_upload('what i pass in this') how can i get image field name
– Urvish Patel
Mar 7 at 12:59
That should be the file input name. eg: If your file browse input name ismyFileInput
then it should be$this->upload->do_upload('myFileInput')
– Saji
Mar 7 at 13:01
Also make sure that you have set attributeenctype="multipart/form-data"
for your form.
– Saji
Mar 7 at 13:02
@UrvishPatel I have updated the answer based on your input here.
– Saji
Mar 7 at 13:14
no i don't want to get absolute path i want file.
– Urvish Patel
Mar 7 at 12:56
no i don't want to get absolute path i want file.
– Urvish Patel
Mar 7 at 12:56
$this->upload->do_upload('what i pass in this') how can i get image field name
– Urvish Patel
Mar 7 at 12:59
$this->upload->do_upload('what i pass in this') how can i get image field name
– Urvish Patel
Mar 7 at 12:59
That should be the file input name. eg: If your file browse input name is
myFileInput
then it should be $this->upload->do_upload('myFileInput')
– Saji
Mar 7 at 13:01
That should be the file input name. eg: If your file browse input name is
myFileInput
then it should be $this->upload->do_upload('myFileInput')
– Saji
Mar 7 at 13:01
Also make sure that you have set attribute
enctype="multipart/form-data"
for your form.– Saji
Mar 7 at 13:02
Also make sure that you have set attribute
enctype="multipart/form-data"
for your form.– Saji
Mar 7 at 13:02
@UrvishPatel I have updated the answer based on your input here.
– Saji
Mar 7 at 13:14
@UrvishPatel I have updated the answer based on your input here.
– Saji
Mar 7 at 13:14
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55043757%2fhow-to-get-image-file-from-absolute-path-in-php%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You have not actually loaded the file into PHP anywhere. All you are doing is fiddling with a string containing a path and filename
– RiggsFolly
Mar 7 at 12:30
actually my question is how can i get file from path. and i am able to get file so i can re_upload
– Urvish Patel
Mar 7 at 12:33
See
file_get_contents()
in the PHP Manual– RiggsFolly
Mar 7 at 12:33
file_get_contents return string in my project but how can i send string for upload image in php
– Urvish Patel
Mar 7 at 12:37