Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9132603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:20:19+00:00 2026-06-17T08:20:19+00:00

I have a Google Chrome extension for my image host and it send an

  • 0

I have a Google Chrome extension for my image host and it send an URL to my website. That URL gets encoded via Javascript’s escape method.

An URL encoded by escape looks like this:

http%253A//4.bp.blogspot.com/-xa4Krfq2V6g/UF2K5XYv3kI/AAAAAAAAAJg/8wrqZQP9ru8/s1600/LuffyTimeSkip.png

I need to get the URL back to normal via PHP somehow, so I can check it against filter_var($the_url, FILTER_VALIDATE_URL) and it obviously fails if the URL is like above.

This is how the Javascript looks like:

function upload(img) {
    var baseurl="http://imgit.org/remote?sent-urls=1&remote-urls=" + escape(img.srcUrl);
    uploadImage(baseurl);
}
function uploadImage(imgurl) {
        chrome.tabs.create({
        url: imgurl,
        selected: true
    });
}

var title = "Upload this image to IMGit";
var id = chrome.contextMenus.create({"title": title, "contexts": ['image'], "onclick": upload});

And this is what I do in PHP:

if (!filter_var($file, FILTER_VALIDATE_URL) || !filter_var(urldecode($file), FILTER_VALIDATE_URL))
{
    throw_error('The entered URLs do not have a valid URL format.', 'index.php#remote'); break;
}

Frankly, urldecode() doesn’t do the job for me. And as you can notice, I am receiving the URL via $_GET.

What would be the best way to handle this situation?

Actual question: How do I unescape the escaped URL in PHP? Is there a better way to handle this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:20:20+00:00Added an answer on June 17, 2026 at 8:20 am

    You’ll want to use encodeURIComponent instead of escape:

    function upload(img) {
        var baseurl="http://imgit.org/remote?sent-urls=1&remote-urls=" + encodeURIComponent(img.srcUrl);
        uploadImage(baseurl);
    }
    

    Then, you can use urldecode inside PHP to get the result you want.

    See this question for an explanation of escape vs. encodeURI vs. encodeURIComponent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that Google Chrome extension can have some HTML and JavaScript. But I
I'm applying an external theme via Google Chrome Extension for a website. The logo
I have a Google Chrome extension that creates a select-all function for a search
I would like to have a Google Chrome extension to rehost any image I
I have a google chrome extension talking to a PHP script via XHR. I
I have created a simple Google chrome extension that overrides CSS classes using the
I have a Google Chrome extension that opens a Twitter Bootstrap dialog (using JQuery
In my Google Chrome extension, I have a content_script that I want to communicate
I am creating a simple Chrome extension that blocks the Google logo image on
I have a Google Chrome extension that upon pressing a button executes an xmlhttp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.