emoleumassi
emoleumassi

Reputation: 5149

React can't download pdf file on the server

import React from 'react';
import Navigation from "../components/Nagivation";

const Home = () => {
    return (
        <div className="home">
            <Navigation/>
            <div className="homeContent">
                <div className="content">
                    <div className="pdf">
                        <a href="./media/AA.pdf" target="_blank">CV Download</a>
                    </div>
                </div>
            </div>
        </div>
    );
};

export default Home;

The file is into app/public/media/AA.pdf

locally it works very fine, App.pdf is open. But on the AWS server, it doesn't. It opens www.aaaa.com/media/AA.pdf but error the page doesn't exist.

Upvotes: 0

Views: 570

Answers (1)

emoleumassi
emoleumassi

Reputation: 5149

Added download attribute <a href="./media/AA.pdf" download="CV.pdf">CV Download</a>

Upvotes: 1

Related Questions